Got: Strip port suffix from Host header if the protocol is known

Created on 24 Aug 2018  Â·  3Comments  Â·  Source: sindresorhus/got

enhancement ✭ help wanted ✭

Most helpful comment

Ok, great. We should at least implement the same tests as https://github.com/request/request/pull/2904/files#diff-5db92d37ce5156ccbf7499555bdd0bf9R183 so we don't accidentally regress in the future.

All 3 comments

> require('.')('http://httpbin.org/anything').then(resp => console.log(resp.body)) // using master
...
> {
  "args": {},
  "data": "",
  "files": {},
  "form": {},
  "headers": {
    "Accept-Encoding": "gzip, deflate",
    "Connection": "close",
    "Host": "httpbin.org",
    "User-Agent": "got/9.1.0 (https://github.com/sindresorhus/got)"
  },
  "json": null,
  "method": "GET",
  "origin": "xxx.xxx.xxx.xxx",
  "url": "http://httpbin.org/anything"
}

Wireshark log:

Hypertext Transfer Protocol
    GET /anything HTTP/1.1\r\n
    user-agent: got/9.1.0 (https://github.com/sindresorhus/got)\r\n
    accept-encoding: gzip, deflate\r\n
    Host: httpbin.org\r\n
    Connection: close\r\n
    \r\n
    [Full request URI: http://httpbin.org/anything]
    [HTTP request 1/1]

Ok, great. We should at least implement the same tests as https://github.com/request/request/pull/2904/files#diff-5db92d37ce5156ccbf7499555bdd0bf9R183 so we don't accidentally regress in the future.

Will do.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alanzhaonys picture alanzhaonys  Â·  4Comments

framerate picture framerate  Â·  4Comments

jamestalmage picture jamestalmage  Â·  3Comments

darksabrefr picture darksabrefr  Â·  3Comments

dAnjou picture dAnjou  Â·  3Comments