Request: how to pass params in request.get?

Created on 9 Aug 2017  ·  3Comments  ·  Source: request/request

how to pass params in request.get?
why can't pass params like jquery?
$.get("xxx.com", { name:"Donald", remarks:"Ducktown" });

Most helpful comment

@chenby
You can pass them as the query string (qs) parameters:

request.get('xxx.com', {qs: {
    name: 'Donald',
    remarks: 'Ducktown'
}}, (err, res, body) => {
   ...
})

All 3 comments

You append them to the url:

xxx.com?name=Donald&remarks=Ducktown

But, if i have a params like object, and i must parse it as string.

@chenby
You can pass them as the query string (qs) parameters:

request.get('xxx.com', {qs: {
    name: 'Donald',
    remarks: 'Ducktown'
}}, (err, res, body) => {
   ...
})
Was this page helpful?
0 / 5 - 0 ratings

Related issues

matrosov-nikita picture matrosov-nikita  ·  3Comments

lupo9557 picture lupo9557  ·  3Comments

victor0402 picture victor0402  ·  4Comments

IgorDePaula picture IgorDePaula  ·  3Comments

ghost picture ghost  ·  3Comments