【发布时间】:2018-12-27 03:59:07
【问题描述】:
我正在尝试使用 Axios 与我的 React 应用程序中的 API 进行通信。我设法让 GET 请求正常工作,但现在我需要一个 POST 请求。
我需要正文是原始文本,因为我将在其中编写一个 MDX 查询。这是我提出请求的部分:
axios.post(baseUrl + 'applications/' + appName + '/dataexport/plantypes' + plan,
{
headers: { 'Authorization': 'Basic xxxxxxxxxxxxxxxxxxx',
'Content-Type' : 'text/plain' }
}).then((response) => {
this.setState({data:response.data});
console.log(this.state.data);
});
这里我添加了内容类型部分。但是如何添加body部分呢?
谢谢。
编辑:
【问题讨论】:
标签: javascript c# reactjs post axios