Reputation: 5172
Route
app.get('/pdf/:id', function(req, res) {
Request
GET http://localhost/pdf/123?option=456&clientId=789
I only get
req.query == { option: '456' }
req.params == { id: '123' }
How comes the second query parameter is cut off? My delimiter is a standard '&'
Upvotes: 13
Views: 4140
Reputation: 5231
If you are using curl or some terminal command, & has a special meaning there. Try gettig it inside quotes as
curl 'http://localhost/pdf/123?option=456&clientId=789'
Upvotes: 32
Reputation: 182
This code is working:
app.get('/pdf/:id', function(req, res) {
console.log(req.params);
console.log(req.query);
res.end();
});
Output:
[ id: '123' ]
{ option: '456', clientId: '789' }
GET /pdf/123?option=456&clientId=789 200 1ms
Upvotes: 1