node.js - How to pass text/plain content in axios POST request in nodejs -


i want pass body parameters shown in screen shot here (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' }; 
  1. responsetype indicates type of data server respond
  2. options arraybuffer , blob , document, json , text, stream

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -