Closed
Description
- 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","":""}
Metadata
Metadata
Assignees
Labels
No labels