Mon*_*757 25 javascript http-put node.js
我正在使用Node.js中的请求模块来执行put请求.我的代码看起来像这样
var request = require('request');
var data = {foo: "bar", woo: "car"};
request({
method: 'PUT',
uri: myURL,
multipart: [{
'content-type':'application/json',
body: JSON.stringify(data)
}]
}, function(error, request, body){
console.log(body);
});
Run Code Online (Sandbox Code Playgroud)
当我运行这个时,我收到一个错误:
"不支持的内容类型:application/json"
use*_*466 36
试试这样:
request({ url: url, method: 'PUT', json: {foo: "bar", woo: "car"}}, callback)
归档时间: |
|
查看次数: |
30419 次 |
最近记录: |