node.js - How to pass text/plain content in axios POST request in nodejs -
i want pass body parameters shown in screen shot (in text/plain format)
i using axios in nodejs/express project . reqeust format shown below:
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); }); };
for how can pass body parameters appropriately?
var config = { headers: { 'content-length': 0, 'content-type': 'text/plain' }, responsetype: 'text' };
responsetype
indicates type of data server respond- options arraybuffer , blob , document, json , text, stream
Comments
Post a Comment