简体   繁体   中英

PUT request works with Postman but not with Request node module

var options = {
    url: 'some url',
    headers:{
       'Authorization':  'some auth'
       'Content-Type': 'application/json'
    },
    body: JSON.stringify(req.body),
    json: true
};

var callback = function(err, response, body){
    ///...some nice stuff
};
request(options, callback)

The status code in the response is 400. If I make the same request using postman everything works fine. Anyone knows what is the problem?

Kinda of hard to say with the details obfuscated. But 400 means Bad Request. I would check all the formatting again. I would also confirm that you have specified the PUT method in the request options.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM