node-restify icon indicating copy to clipboard operation
node-restify copied to clipboard

req.getPath() problem

Open rdgms opened this issue 13 years ago • 1 comments

Hi, im having a problem with req.getPath , when i call getPath return a not cleaned url . My code: server.get('/users/:username',function);

i expected when i call getPath get "/users" or "/users/username" but i get "/user/rodrigo"

rdgms avatar Feb 01 '13 16:02 rdgms

No, req.getPath() returns you the actual RESOURCE-URI (without query string) that was sent. Your /users/:username is a param fill in. So you have req.getPath() is what you actually got, and req.params.username is the value rodrigo.

mcavage avatar Feb 28 '13 16:02 mcavage