mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
encode $resource query params using encodeURIComponent
This commit is contained in:
parent
885c3ad5dd
commit
e1d122a4b7
2 changed files with 8 additions and 2 deletions
|
|
@ -26,7 +26,7 @@ Route.prototype = {
|
|||
var query = [];
|
||||
forEachSorted(params, function(value, key){
|
||||
if (!self.urlParams[key]) {
|
||||
query.push(encodeUriSegment(key) + '=' + encodeUriSegment(value));
|
||||
query.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
|
||||
}
|
||||
});
|
||||
url = url.replace(/\/*$/, '');
|
||||
|
|
|
|||
|
|
@ -55,10 +55,16 @@ describe("resource", function() {
|
|||
//buzz api which uses @self
|
||||
|
||||
var R = resource.route('/Path/:a');
|
||||
xhr.expectGET('/Path/doh@foo?bar=baz@1').respond({});
|
||||
xhr.expectGET('/Path/doh@foo?bar=baz%401').respond({});
|
||||
R.get({a: 'doh@foo', bar: 'baz@1'});
|
||||
});
|
||||
|
||||
it('should encode & in url params', function() {
|
||||
var R = resource.route('/Path/:a');
|
||||
xhr.expectGET('/Path/doh&foo?bar=baz%261').respond({});
|
||||
R.get({a: 'doh&foo', bar: 'baz&1'});
|
||||
});
|
||||
|
||||
it("should build resource with default param", function(){
|
||||
xhr.expectGET('/Order/123/Line/456.visa?minimum=0.05').respond({id:'abc'});
|
||||
var LineItem = resource.route('/Order/:orderId/Line/:id:verb', {orderId: '123', id: '@id.key', verb:'.visa', minimum:0.05});
|
||||
|
|
|
|||
Loading…
Reference in a new issue