我的代码如下所示:
axios.post('https://api.sandbox.xyz.com/v1/order/new', JSON.stringify({
"request": "/v1/order/new",
"nonce": 123462,
"client_order_id": "20150102-4738721",
"symbol": "btcusd",
"amount": "1.01",
"price": "11.13",
"side": "buy",
"type": "exchange limit"
}), config)
.then(function(response) {
console.log(response);
res.json({
data: JSON.stringify(response)
})
})
.catch(function(error) {
console.log(error);
res.send({
status: '500',
message: error
})
});
现在它说的是Unhandled promise rejection (rejection id: 2): TypeError: Converting circular structure to JSON
对于代码res.json({data:JSON.stringify(response)})
那么,这段代码中是否缺少任何内容?
axios.post('https://api.sandbox.xyz.com/v1/order/new', JSON.stringify({
"request": "/v1/order/new",
"nonce": 123462,
"client_order_id": "20150102-4738721",
"symbol": "btcusd",
"amount": "1.01",
"price": "11.13",
"side": "buy",
"type": "exchange limit"
}), config)
.then(function(response) {
res.send(response.data)
})
.catch(function(error) {
res.send({
status: '500',
message: error
})
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)