-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
url: fix format when query is not an object #6005
Conversation
url.format uses query if search is falsy. Currently query is only used if it is an object. Query will now be inserted if its value is truthy. Fixes: #6004
This would require a documentation update. |
@@ -1586,3 +1586,6 @@ for (let i = 0; i < throws.length; i++) { | |||
} | |||
assert(url.format('') === ''); | |||
assert(url.format({}) === ''); | |||
|
|||
// https://github.com/nodejs/node/issues/6004 | |||
assert.equal(url.format({pathname:'/foo', query: 'bar=baz'}), '/foo?bar=baz'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit: there should be a space after pathname:
Isn't this a semver major since an error is no longer thrown where an error was thrown before? |
@benjamingr ... I may be missing something but I'm not seeing a change in error handling. @ajafff ... while this is generally ok, I'm curious why not simply use |
7da4fd4
to
c7066fb
Compare
@ajafff are you still planning to work on this? |
c133999
to
83c7a88
Compare
Closing given the lack of forward progress on this |
Pull Request check-list
Please make sure to review and check all of these items:
make -j8 test
(UNIX) orvcbuild test nosign
(Windows) pass withthis change (including linting)?
test (or a benchmark) included?
existing APIs, or introduces new ones)?
Affected core subsystem(s)
url
Description of change
url.format uses query if search is falsy. Currently query is only used
if it is an object. Query will now be inserted if its value is truthy.
Fixes: #6004