Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 7a82951

Browse files
committed
test($resource): add test case for the not-stripping of trailing slashes
1 parent 1382401 commit 7a82951

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/ngResource/resourceSpec.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
'use strict';
22

33
describe("resource", function() {
4-
var $resource, CreditCard, callback, $httpBackend;
4+
var $resource, CreditCard, callback, $httpBackend, resourceProvider;
55

66
beforeEach(module('ngResource'));
7+
8+
beforeEach(module(function ($resourceProvider) {
9+
resourceProvider = $resourceProvider;
10+
}));
11+
712
beforeEach(inject(function($injector) {
813
$httpBackend = $injector.get('$httpBackend');
914
$resource = $injector.get('$resource');
@@ -177,6 +182,17 @@ describe("resource", function() {
177182
});
178183

179184

185+
it('should not strip trailing slashes if configured not to', function() {
186+
// Set the new behaviour
187+
resourceProvider.setStripTrailingSlashes(false);
188+
189+
var R = $resource('http://localhost:8080/Path/:a/');
190+
191+
$httpBackend.expect('GET', 'http://localhost:8080/Path/foo/').respond();
192+
R.get({a: 'foo'});
193+
});
194+
195+
180196
it('should not encode @ in url params', function() {
181197
//encodeURIComponent is too agressive and doesn't follow http://www.ietf.org/rfc/rfc3986.txt
182198
//with regards to the character set (pchar) allowed in path segments

0 commit comments

Comments
 (0)