swagger-router
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -28,4 +28,4 @@ "use strict"; | ||
} else if (key.name && key.pattern | ||
&& key.modifier !== '+' | ||
&& key.pattern.constructor === String) { | ||
&& key.modifier !== '+' | ||
&& key.pattern.constructor === String) { | ||
// A named but plain key. | ||
@@ -57,5 +57,5 @@ child._paramName = key.name; | ||
if (params[res._paramName]) { | ||
params[res._paramName] += '/' + segment; | ||
params[res._paramName] += '/' + encodeURIComponent(segment); | ||
} else { | ||
params[res._paramName] = segment; | ||
params[res._paramName] = encodeURIComponent(segment); | ||
} | ||
@@ -176,2 +176,2 @@ // We are done. | ||
module.exports = Node; | ||
module.exports = Node; |
@@ -219,2 +219,2 @@ "use strict"; | ||
module.exports = URI; | ||
module.exports = URI; |
{ | ||
"name": "swagger-router", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "An efficient swagger 2 based router with support for multiple APIs. For use in RESTBase.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -193,2 +193,22 @@ "use strict"; | ||
}, | ||
'/en.wikipedia.org/v1/several/optional/path/a%2fb': { | ||
value: '/several{/optional}{/path}{+segments}', | ||
params: { | ||
domain: 'en.wikipedia.org', | ||
optional: 'optional', | ||
path: 'path', | ||
segments: 'a%2Fb', | ||
}, | ||
permissions: [] | ||
}, | ||
'/en.wikipedia.org/v1/several/optional/path/segments/a%2fb': { | ||
value: '/several{/optional}{/path}{+segments}', | ||
params: { | ||
domain: 'en.wikipedia.org', | ||
optional: 'optional', | ||
path: 'path', | ||
segments: 'segments/a%2Fb', | ||
}, | ||
permissions: [] | ||
}, | ||
'/en.wikipedia.org/v1/simple/templated': { | ||
@@ -299,2 +319,2 @@ value: '/simple/{templated}{/path}', | ||
}); | ||
}); | ||
}); |
@@ -71,2 +71,7 @@ "use strict"; | ||
it('{+patterns} dynamic expand with %2F', function() { | ||
var uri = new URI('/{domain:some}/path/to/{+rest}',{}, true); | ||
deepEqual(uri.expand({rest: 'foo%2Fbar'}).toString(), '/some/path/to/foo%2Fbar'); | ||
}); | ||
it('decoding / encoding', function() { | ||
@@ -128,2 +133,2 @@ var uri = new URI('/{domain:some}/a%2Fb/to/100%/%FF', {domain: 'foo/bar'}, true); | ||
}); | ||
}); | ||
}); |
80431
1762