node.js - request follow redirection without post data -


i'm using request.js http request in node.js.

request({   method: 'post',   uri: 'http://www.example.com/getdata',   followallredirects: true,   followoriginalhttpmethod: true,   json: true,   form: {     id: 1,     msg: 'test data',   }, }, (err, res, body) => {}) 

let's when post { id: 1, msg: 'test data' } http://www.example.com/getdata, proxy redirect http://us.example.com/getdata.

the codes above redirect http://us.example.com/getdata, how can set redirection post data?

this hard if not impossible.

if redirects done sending "301 moved permanently" or "302 found" http status code in practice works if "303 see other" sent, i.e. get request made with no data sent in body.

see list of http status codes on wikipedia:

this example of industry practice contradicting standard. http/1.0 specification (rfc 1945) required client perform temporary redirect (the original describing phrase "moved temporarily"), popular browsers implemented 302 functionality of 303 see other. therefore, http/1.1 added status codes 303 , 307 distinguish between 2 behaviours. however, web applications , frameworks use 302 status code if 303.

there "307 temporary redirect" (since http/1.1) created address issue not allowed change http method - redirect post should still post - see wikipedia:

in case, request should repeated uri; however, future requests should still use original uri. in contrast how 302 historically implemented, request method not allowed changed when reissuing original request. example, post request should repeated using post request.

but if work in particular case hard tell depends on api you're calling , require changes api implementation.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -