Call router's first method and pass a URL which contains spaces or %20s as its parameters.
var params = router.first("/products/1/Intel/Pentium MMX 233", 'POST');
Confirm that the 'params' var equals to false instead of this : {"method":"POST","controller":"products","action":"update","product":"Pentium MMX 233","vendor":"Intel","productKeyScore":"1"}
Suggested Resolution:
Modify the code on these following places:
On Key.coffee line 16, line 93 & route.coffee line 10 => modify the regex so that it would recognise %20 (e.g. /[\w-%20]+/ ).
Then on Route.coffee line 376 => get rid %20 on the part variable. The changes would be looked like this:
// stash the pairings for loop 2
pairings.push( [ segm, decodeURI(part) ] )
I hope this suggestion would make sense to you unless you have reasons why not allowing the regex to recognise %20 or spaces.
Steps to replicate this issue:
Setup a URI template on Barista router: var Barista = require('barista').Router; var router = new Router;
router.post('/products/:productKeyScore/:vendor/*product(/)') .to('products.update');
Call router's first method and pass a URL which contains spaces or %20s as its parameters. var params = router.first("/products/1/Intel/Pentium MMX 233", 'POST');
Confirm that the 'params' var equals to false instead of this : {"method":"POST","controller":"products","action":"update","product":"Pentium MMX 233","vendor":"Intel","productKeyScore":"1"}
// stash the pairings for loop 2
pairings.push( [ segm, decodeURI(part) ] )
I hope this suggestion would make sense to you unless you have reasons why not allowing the regex to recognise %20 or spaces.
Many many thanks.