From b27b13071ad75a76358c0204853a9f2b73105c1c Mon Sep 17 00:00:00 2001 From: Pradnya Baviskar Date: Fri, 23 Jan 2015 18:34:13 +0530 Subject: [PATCH] Add test case to demonstrate url-encoded http path --- test/rest.middleware.test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/rest.middleware.test.js b/test/rest.middleware.test.js index 7cec6d7e..429f3fc8 100644 --- a/test/rest.middleware.test.js +++ b/test/rest.middleware.test.js @@ -112,6 +112,19 @@ describe('loopback.rest', function() { request(app).get('/domain1/CustomModelPath').expect(200).end(done); }); + it('should report 200 for url-encoded HTTP path', function(done) { + var ds = app.dataSource('db', { connector: loopback.Memory }); + var CustomModel = ds.createModel('CustomModel', + { name: String }, + { http: { path: 'domain%20one/CustomModelPath' } + }); + + app.model(CustomModel); + app.use(loopback.rest()); + + request(app).get('/domain%20one/CustomModelPath').expect(200).end(done); + }); + it('includes loopback.token when necessary', function(done) { givenUserModelWithAuth(); app.enableAuth();