MethodNotAllowedHttpException using Form Request Validation on Laravel 5.5

前端 未结 2 2041
隐瞒了意图╮
隐瞒了意图╮ 2020-12-20 08:41

This is pretty strange when i use Form Request Validation on Laravel 5.5, all my post request gonna be 405 Method Not Allowed, but getting normal when i use standard validat

2条回答
  •  星月不相逢
    2020-12-20 09:21

    when you send the request from insomnia make sure to add the headers;

    accept: application/json and Content-Type: application/json

    that way laravel knows that its an api request and will use routes defined on api.php and not web.php routes.

提交回复
热议问题