-
Notifications
You must be signed in to change notification settings - Fork 7.3k
url.parse() behavior change between node 0.10 and node 0.12, intentional? #8332
Comments
Seems that the fact I'm not sure whether this should be considered a bug or not. /cc @indutny @tjfontaine |
karma is broken by this change, see karma-runner/karma#1182 is this a regression from node, or it is intentional? |
@floverdevel Doubt it was intentional, but it's also not a documented feature that |
The behavior should be consistent between the two parse paths. PR with a test & fix forthcoming. |
Match the behavior of the slow path by setting url.query to an empty object when the url contains no query, but query parsing is requested. Also add a test for this case. issue: nodejs#8332
Match the behavior of the slow path by setting url.query to an empty object when the url contains no query, but query parsing is requested. Also add a test for this case. issue: nodejs#8332
Match the behavior of the slow path by setting url.query to an empty object when the url contains no query, but query parsing is requested. Also add a test for this case, and update the documents to clearly reflect this behavior. issue: nodejs#8332
Match the behavior of the slow path by setting url.query to an empty object when the url contains no query, but query parsing is requested. Also add a test for this case, and update the documents to clearly reflect this behavior. Fixes: #8332 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Fixed by b705b73. |
I note that in version 0.10.26 (at least),
url.parse('/foo', true)
always sets the.query
property of the returned object to at least an empty object, but in node 0.12 (well, the tip of the current 0.12 branch which reports itself as 0.11.14-pre),url.parse()
may set the.query
property tonull
if the input URL string did not have a query string.Demo output: https://gist.github.com/metamatt/e654f8ce7e25ed0fc906
I don't see any mention of this in the Node 0.11.13 docs or the API changes between 0.10 and 0.12 document.
I'm filing this issue to confirm whether the behavior change was known and intentional, and wondering whether the code should change or the docs should change.
NB: karma, at least, cares and is broken by the new behavior; see for example https://github.com/karma-runner/karma/blob/891a4528a51ba4806014a551ce8892072807bb5a/lib/middleware/karma.js#L40 which assumes the
url.parse()
result always has.query
being an object it can look inside.The text was updated successfully, but these errors were encountered: