1
我想通過身體參數Axios公司POST請求text/plain的內容顯示在屏幕截圖(在text/plain的格式)如何通過在的NodeJS
我用我的NodeJS /快遞愛可信項目。我的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);
});
};
爲此,我該如何正確傳遞正文參數?
到底是什麼問題?這看起來好像沒什麼問題 – lumio
我想通過'{ 「請求」: 「/ V1 /順序/新」, 「現時」:123457, 「client_order_id」: 「20150102-4738721」, 「符號」: 「btcusd」, 「amount」:「34.12」, 「price」:「622.13」, 「side」:「buy」, 「type」:「exchange limit」 }'作爲身體參數,我將如何去做? –
而不是'{firstName:'...'}'你使用剛發佈的那個對象? – lumio