简体   繁体   English

PUT请求适用于Postman,但不适用于Request节点模块

[英]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. 响应中的状态码为400。如果我使用邮递员发出相同的请求,则一切正常。 Anyone knows what is the problem? 有人知道是什么问题吗?

Kinda of hard to say with the details obfuscated. 有点难以解释的细节让人困惑。 But 400 means Bad Request. 但是400表示错误请求。 I would check all the formatting again. 我会再次检查所有格式。 I would also confirm that you have specified the PUT method in the request options. 我还要确认您已在请求选项中指定了PUT方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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