browserify / browserify/http-browserify

http browserify broken when sending a full node url object

Open
#27 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
245
Forks
104
PR merge metrics
No merged PRs in 30d

Description

```
var url = {
host: "localhost:8081",
hostname: "localhost",
href: "http://localhost:8081/api/foo?bar=baz",
method: "GET",
path: "/api/foo?bar=baz",
pathname: "/api/foo",
port: "8081",
protocol: "http:",
query: "bar=baz",
search: "?bar=baz",
slashes: true
};
var request = http.get(url, noop);
```

```
expected: "http://localhost:8081/api/foo?bar=baz"
actual: "http://localhost:8081:8081/api/foo?bar=baz"
```

The url that is requested has the port in it 2 times. This is because of this line.
https://github.com/substack/http-browserify/blob/master/index.js#L7

I am finishing up a pull request to fix this where it will try host first, then hostname+port.

Please let me know if you have any input.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at index.js line 7, where the request URL is assembled from the supplied Node URL object. Reproduce the example with http.get and verify that the generated URL is http://localhost:8081/api/foo?bar=baz, with the port included only once.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.