You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If not specified, http-browserify sets the protocol to window.location.protocol. This differs from the behavior of Node (see https://nodejs.org/api/http.html#http_http_request_options_callback ). I assume the reasoning was to make https requests if the current location is also https (but I could be wrong here).
Does it make sense to mimic Node's behavior exactly, and just default to http: ?
The issue I'm running into is when running a script locally in the browser, so the protocol is "file:". http-browserify then tries to make file:// requests, which obviously fail.
The text was updated successfully, but these errors were encountered:
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:
If not specified, http-browserify sets the protocol to
window.location.protocol
. This differs from the behavior of Node (see https://nodejs.org/api/http.html#http_http_request_options_callback ). I assume the reasoning was to make https requests if the current location is also https (but I could be wrong here).Does it make sense to mimic Node's behavior exactly, and just default to http: ?
The issue I'm running into is when running a script locally in the browser, so the protocol is "file:". http-browserify then tries to make file:// requests, which obviously fail.
The text was updated successfully, but these errors were encountered: