【发布时间】:2017-09-20 19:31:57
【问题描述】:
我在我的 nodejs/express 项目中使用 axios。我的reqeust格式如下图:
var config = {
headers: {
'Content-Length': 0,
'Content-Type': 'text/plain'
}
};
const testInput = (req, res) => {
axios.post('https://api.sandbox.xyz.com/v1/order/new', { firstName: 'Marlon' }, config)
.then(function(response) {
console.log('saved successfully')
})
.catch(function(error) {
console.log(error);
});
};
为此,我怎样才能适当地传递正文参数?
【问题讨论】:
-
到底是什么问题?我觉得很好
-
我想将
{ "request": "/v1/order/new", "nonce": 123457, "client_order_id": "20150102-4738721", "symbol": "btcusd", "amount": "34.12", "price": "622.13", "side": "buy", "type": "exchange limit" }作为正文参数传递,我该怎么做? -
你使用刚刚发布的对象而不是
{ firstName: '...' }?