Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/URI.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@
var t = '';
var unique, key, i, length;
for (key in data) {
if (hasOwn.call(data, key) && key) {
if (hasOwn.call(data, key)) {
if (isArray(data[key])) {
unique = {};
for (i = 0, length = data[key].length; i < length; i++) {
Expand Down
6 changes: 6 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,9 @@

u.query('?&foo=bar&foo=bar').normalizeQuery();
equal(u.query(), 'foo=bar', 'duplicate key=value resolution');

u.query('?=bar').normalizeQuery();
equal(u.query(), '=bar', 'query without key');
});
test('normalizeFragment', function() {
var u = new URI('http://example.org/foobar.html#');
Expand All @@ -1330,6 +1333,9 @@
test('readable', function() {
var u = new URI('http://foo:[email protected]/hello%20world/ä.html?foo%5B%5D=b+är#fragment');
equal(u.readable(), 'http://www.exämple.org/hello world/ä.html?foo[]=b är#fragment', 'readable URL');

var u = new URI('http://example.org/?=5640');
equal(u.readable(), 'http://example.org/?=5640', 'readable URL: query without key');
});

module('resolving URLs');
Expand Down