var req ={
"request": {
"header": {
"username": "name",
"password": "password"
},
"body": {
"shape":"round"
}
}
};
request.post(
{url:'posturl',
body: JSON.stringify(req),
headers: { "content-type": "application/x-www-form-urlencoded"}
},
function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body)
}
}
);
Run Code Online (Sandbox Code Playgroud)
我想在req变量中发送原始请求体.它正在邮递员,但在节点js我无法发送原始json作为发布请求的请求主体.