I am using dingo/api for a project and all of my routes work other than 1.
routes.php
$api = app('api.router');
$api->version('v1',['prefix' => 'api'], function ($api) {
$api->post('users', "App\Http\Controllers\Auth\UsersController@store");
...
});
store method :
/**
*
* @param \App\Http\Requests\Auth\StoreUserRequest $request
* @return \Illuminate\Http\Response
*/
public function store(StoreUserRequest $request)
{
if( ! $this->isAdminRequest() )
{
return $this->dispatch(new RegisterUserCommand($request));
}
}
This route throws 405 Method Not Allowed Exception
.
php artisan api:routes
shows that it is registered, both locally and on server. I am using POSTMAN to test my api and have all required fields. In response I do get Allow : POST.
NOTE :
- There are other post routes that work perfectly.
- There are other UsersController routes that work perfectly
- I have tried removing all other routes and with just this, it still does not work.
Any help is appreciated. Thanks.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire