如何在nodejs中的axios POST请求中传递文本/纯文本内容

我想通过身体参数如屏幕截图所示 这里以文本/纯文本格式

我在我的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); }); }; 

为此我怎样才能适当地传递身体参数?

 var config = { headers: { 'Content-Length': 0, 'Content-Type': 'text/plain' }, responseType: 'text' }; 
  1. responseType指示服务器将响应的数据的types
  2. 选项是arrays缓冲区,blob,文档,json,文本,stream