From e9ce22592aaf36ce57c4eaa6202842d9f383d172 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 10 Feb 2011 17:57:42 -0800 Subject: $resource should encode url params with encodeURIComponent --- test/ResourceSpec.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/ResourceSpec.js b/test/ResourceSpec.js index 8b78df12..d61282ea 100644 --- a/test/ResourceSpec.js +++ b/test/ResourceSpec.js @@ -40,6 +40,14 @@ describe("resource", function() { R.get({a:4, b:5, c:6}); }); + it('should correctly encode url params', function(){ + var R = resource.route('/Path/:a'); + xhr.expectGET('/Path/foo%231').respond({}); + xhr.expectGET('/Path/doh!%40foo?bar=baz%231').respond({}); + R.get({a: 'foo#1'}); + 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}); -- cgit v1.2.3