Comments (2)
+1
from http-browserify.
I experienced the same problem. I think that http-browserify sets the protocol to window.location.protocol
in any case. I tried to call a request to my API, eg. http://<hostname>/api
, so I specified the HTTP protocol and http-browserify still tries to send the request to file://<hostname>/api
. The reason is that in the lib/request.js
file URI
is composed from scratch. Take a look:
self.uri = (params.protocol || 'http:') + '//'
+ params.host
+ (params.port ? ':' + params.port : '')
+ (params.path || '/')
;
In my case, it does not work. I need the same URI that I put to a request method. I fixed it by adding a below line after code that I've posted above:
if (params.href !== 'undefined' && params.protocol === 'file:') self.uri = params.href;
It resolved a few problems in my project but I am not sure is this change will not cause breaking a code in another scenario.
from http-browserify.
Related Issues (20)
- Use IANA HTTP status codes to match newer node
- HEAD request not working on Edge
- Upgrade `Base64` dependency
- Allow XMLHttpRequest to be mocked by test frameworks (e.g., jasmine-ajax; sinon) HOT 2
- Response object does not have response.headers HOT 2
- file://http:// HOT 1
- Base64 package casing has changed
- Request::abort() not implemented
- Response inherits from Stream instead of Stream.Readable (requiring request module browserify workaround) HOT 4
- What does the protip mean?
- Cannot process certain response strings
- globalAgent not defined HOT 3
- Return Buffer objects from requests where it makes sense HOT 5
- case insensitive headers
- http.request not handling relative paths HOT 1
- Not working on mobile HOT 1
- Missing setNoDelay method on Request
- no window object present HOT 3
- Needs Maintainer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from http-browserify.