使用axios进行请求时,MethodNotAllowedHttpException(流明) [英] MethodNotAllowedHttpException (lumen) while making request with axios
本文介绍了使用axios进行请求时,MethodNotAllowedHttpException(流明)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为在腔内插入待办事项创建了一条路径,使用邮递员可以很好地工作,但是在我的使用axios发送的应用程序请求中,却出现了错误
Created a route for inserting todo in lumen , its working perfectly using postman but in my react application request sending with axios , it getting error
this.apiUrl = 'http://lumenback.dev/createTodo';
axios.post(this.apiUrl, {
todo: this.state.todo,
todo_date: this.props.curDate
})
.then(function (response) {
console.log(response);
}).catch(function (error) {
console.log(error);
});
提前谢谢...
推荐答案
我的应用程序不接受跨域请求.
Your application is not accepting the Cross domain requests I guess.
这是一个答案 Lumen API CORS Ajax 405不允许的方法我写了设置Cors并使其与React和Lumen 5.5一起工作.
Here is an answer Lumen API CORS Ajax 405 Method Not Allowed I wrote to setup Cors and make it working with React and Lumen 5.5.
看看这是否有帮助.
我无法发表评论,因此请在此处编写此解决方案.
I cannot comment so writing this solution here.
这篇关于使用axios进行请求时,MethodNotAllowedHttpException(流明)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文