Problem with query params
See original GitHub issueReproduction
Steps to reproduce the behavior:
When using node-fetch version 2.6.3, making a request to http://nginx/transactions/total?month=2021-09 do not send the url params. If I am using node-fetch version 2.6.1 everything work fine. Enabling node http verbose log, when making the request using node-fetch version 2.6.1 I get:
HTTP 52: createConnection nginx:80: {
protocol: 'http:',
slashes: true,
auth: null,
host: 'nginx',
port: 80,
hostname: 'nginx',
hash: null,
search: '?month=2021-09',
query: 'month=2021-09',
pathname: '/api/transactions/total',
path: null,
href: 'http://nginx/api/transactions/total?month=2021-09',
method: 'GET',
headers: [Object: null prototype] {
Authorization: [
'Bearer ....'
],
Accept: [ '*/*' ],
'User-Agent': [ 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)' ],
'Accept-Encoding': [ 'gzip,deflate' ],
Connection: [ 'close' ]
},
agent: undefined,
servername: 'nginx',
_agentKey: 'nginx:80:'
}
but using node-fetch version 2.6.3 I get
HTTP 24: createConnection nginx:80: {
path: null,
pathname: '/api/transactions/total',
hostname: 'nginx',
protocol: 'http:',
port: 80,
hash: '',
search: '?month=2021-09',
query: undefined,
href: 'http://nginx/api/transactions/total?month=2021-09',
method: 'GET',
headers: [Object: null prototype] {
Authorization: [
'Bearer ....
],
Accept: [ '*/*' ],
'User-Agent': [ 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)' ],
'Accept-Encoding': [ 'gzip,deflate' ],
Connection: [ 'close' ]
},
agent: undefined,
host: 'nginx',
servername: 'nginx',
_agentKey: 'nginx:80:'
}
Note the query part is undefined when using node-fetch version 2.6.3.
Expected behavior
The behaviour of the two versions should be the same.
Screenshots
Your Environment
software | version |
---|---|
node-fetch | 2.6.3 |
node | 14.17.3 |
npm | 6.14.3 |
Operating System | linux |
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Reactions:18
- Comments:14 (5 by maintainers)
Top Results From Across the Web
What's the problem with required query parameters?
When reviewing API designs, I often encounter operations such as GET /resources?queryParameter=value where the query parameter is required.
Read more >Routing with query params not working - Stack Overflow
Try this: this.router.navigate(['/inventory/client'], { queryParams: { id: this.vendorId} });. And have a look here: Passing Optional ...
Read more >DRF: Is it possible to error when given invalid query params ...
I am working on a project with other python programmers and they want the API to return a 422 when list filtering with...
Read more >Consuming rest api - problem with formatting query parameter
Consuming rest api - problem with formatting query parameter. Question. REST. Hello,. I am using version 11.6.27 Build 11455, and I am working...
Read more >Redirect Issue – Query Param Underscore - WordPress.org
It's failing as a source. If there is underscore in query string parameters in source then query string parameters are not passed to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry about this, looking into it
v2.6.4 was just released, and fixes this for me 👍