Skip to content

url: fix format when query is not an object - #6005

Closed
ajafff wants to merge 1 commit into
nodejs:masterfrom
ajafff:url-format-query
Closed

url: fix format when query is not an object#6005
ajafff wants to merge 1 commit into
nodejs:masterfrom
ajafff:url-format-query

Conversation

@ajafff

Copy link
Copy Markdown
Contributor

Pull Request check-list

Please make sure to review and check all of these items:

  • Does make -j8 test (UNIX) or vcbuild test nosign (Windows) pass with
    this change (including linting)?
  • Is the commit message formatted according to CONTRIBUTING.md?
  • If this change fixes a bug (or a performance problem), is a regression
    test (or a benchmark) included?
  • Is a documentation update included (if this change modifies
    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

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
@jasnelljasnell added url Issues and PRs related to the legacy built-in url module. semver-minor PRs that contain new features and should be released in the next minor version. labels Apr 2, 2016
@mscdex

Copy link
Copy Markdown
Contributor

@cjihrig

Copy link
Copy Markdown
Contributor

This would require a documentation update.

assert(url.format({}) === '');

// https://github.com/nodejs/node/issues/6004
assert.equal(url.format({pathname:'/foo', query: 'bar=baz'}), '/foo?bar=baz');

Copy link
Copy Markdown
Contributor

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:

@benjamingr

Copy link
Copy Markdown
Member

Isn't this a semver major since an error is no longer thrown where an error was thrown before?

@jasnell

Copy link
Copy Markdown
Member

@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 search?

@estliberitas
estliberitasforce-pushed the master branch 2 times, most recently from 7da4fd4 to c7066fbCompareApril 26, 2016 05:23
@TrottTrott mentioned this pull request May 5, 2016
2 tasks
@cjihrig

Copy link
Copy Markdown
Contributor

@ajafff are you still planning to work on this?

@rvagg
rvaggforce-pushed the master branch 2 times, most recently from c133999 to 83c7a88CompareOctober 18, 2016 17:01
@jasnelljasnell added the stalled Issues and PRs that are stalled. label Mar 1, 2017
@jasnell

Copy link
Copy Markdown
Member

Closing given the lack of forward progress on this

@jasnelljasnell closed this Mar 1, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-minorPRs that contain new features and should be released in the next minor version.stalledIssues and PRs that are stalled.urlIssues and PRs related to the legacy built-in url module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

url: format ignores query if it's no object

5 participants

@ajafff@mscdex@cjihrig@benjamingr@jasnell