Vue Axios不返回响应

时间:2019-06-23 14:17:46

标签: vue.js post get axios put

我对vue axios有问题。

我正在尝试使用get / put发送数据,但无法在服务器端读取它。 使用POST一切正常,所以我不知道问题出在哪里。 顺便说一句。一切都在PostMan中运行。

axios({
    method: 'PUT',
    url: `http://example.org`,
    data:  Qs.stringify(data),
}).then(response => (console.log(response.data)))

2 个答案:

答案 0 :(得分:0)

我正在以这种方式使用axios PUT,并且效果很好。

axios.put("http://example.org", "plaintextbodyorstringifiedmaybe", {headers: {"Content-Type": "text/plain"}}).then(response => (console.log(response.data)))

答案 1 :(得分:0)

HTTP PUT响应的正文为HTTP PUT on MDN

如果请求成功,则响应主体为空,而成功的POST请求的响应具有主体HTTP POST on MDN