Skip to content
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

Seems, 'url.parse' isn't working properly #824

Closed
shunanya opened this issue Jul 14, 2016 · 1 comment
Closed

Seems, 'url.parse' isn't working properly #824

shunanya opened this issue Jul 14, 2016 · 1 comment

Comments

@shunanya
Copy link

shunanya commented Jul 14, 2016

  • URL: doesn't matter
  • Browser version: doesn't matter
  • Operating system: Ubuntu 14.x
  • Node.js version: 4.3.1

Seems, 'url.parse' isn't working properly in case when the query string in URL is ended by '&'.
The parsing contains blank key with blank value (see below example)

var util = require('util');
var url = require('url');

var u = '/b?/b?&page_rendering_time=544&total_load_time=1735&';
console.log('input: '+u);
var urlObj = url.parse(u, true, true);
console.log(util.inspect(urlObj))
console.log('query: ' + JSON.stringify(urlObj.query))

The output of this code is the following

input: /b?page_rendering_time=544&total_load_time=1735&
Url {
  protocol: null,
  slashes: null,
  auth: null,
  host: null,
  port: null,
  hostname: null,
  hash: null,
  search: '?page_rendering_time=544&total_load_time=1735&',
  query: { page_rendering_time: '544', total_load_time: '1735', '': '' },
  pathname: '/b',
  path: '/b?page_rendering_time=544&total_load_time=1735&',
  href: '/b?page_rendering_time=544&total_load_time=1735&' }
query: {"page_rendering_time":"544","total_load_time":"1735","":""}

@ghost
Copy link

ghost commented Jul 14, 2016

hey! you might want to repost this issue at http://github.com/nodejs/help, since this is the repository for the website, not for node.js itself. thanks 👍

@ghost ghost closed this as completed Jul 14, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant