-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Closed
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.questionIssues that look for answers.Issues that look for answers.urlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.whatwg-urlIssues and PRs related to the WHATWG URL implementation.Issues and PRs related to the WHATWG URL implementation.
Description
- Version: v8.10.0
- Platform: Linux 4.15.0-29-generic Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: http
When passing an URL
with query params as the first argument to http.get()
method, the query is ignored.
const URL = require('url');
const http = require('http');
const assert = require('assert');
function parseJsonResp(next) {
return function(resp) {
var raw = '';
resp.on('data', function(chunk) {
raw += chunk;
});
resp.on('end', function() {
next(null, JSON.parse(raw));
});
}
};
const url = URL.parse('http://httpbin.org/get');
url.query = {foo: 'bar'}
http.get(url, parseJsonResp(function(err, obj) {
assert(obj.args.foo === 'bar'); // It fails here
}));
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.questionIssues that look for answers.Issues that look for answers.urlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.whatwg-urlIssues and PRs related to the WHATWG URL implementation.Issues and PRs related to the WHATWG URL implementation.