url.parse() behavior change between node 0.10 and node 0.12, intentional? #8332
Description
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 to null
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.