safe-url-assembler
Advanced tools
Comparing version 1.3.4 to 1.3.5
@@ -86,4 +86,4 @@ var extend = require('extend'); | ||
} | ||
key = encodeURI(key); | ||
value = encodeURI(value); | ||
key = encodeURIComponent(key); | ||
value = encodeURIComponent(value); | ||
var chainable = this._chain(); | ||
@@ -90,0 +90,0 @@ var previous = this.pathname; |
{ | ||
"name": "safe-url-assembler", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "Assemble urls from route-like templates (/path/:param), with URI components encoding", | ||
@@ -39,11 +39,11 @@ "main": "index.js", | ||
"chai": "^3.5.0", | ||
"istanbul": "^0.4.4", | ||
"mocha": "^2.5.3", | ||
"proxyquire": "^1.7.9", | ||
"sinon": "^1.17.4" | ||
"istanbul": "^0.4.5", | ||
"mocha": "^3.2.0", | ||
"proxyquire": "^1.7.11", | ||
"sinon": "^1.17.7" | ||
}, | ||
"dependencies": { | ||
"extend": "~3.0.0", | ||
"qs": "~6.2.0" | ||
"qs": "~6.3.0" | ||
} | ||
} |
@@ -78,4 +78,15 @@ var expect = require('chai').expect; | ||
it('should encode them in the final URL (with param)', function() { | ||
myUrl = UrlAssembler('http://example.com') | ||
.segment('/search/:p') | ||
.param({ | ||
'p': "-_.!~*'() /;,?:@&=+$_abc_日本語" | ||
}); | ||
expect(myUrl.toString()).to.equal( | ||
'http://example.com' | ||
+ "/search/-_.!~*'()%20%2F%3B%2C%3F%3A%40%26%3D%2B%24_abc_%E6%97%A5%E6%9C%AC%E8%AA%9E" | ||
); | ||
}); | ||
}) | ||
}); |
23877
454