Trying to figure out why my DELETE request not working..I'm using Postman and RESTClient in Firefox to send this DELETE request
DELETE http://localhost:8000/api/access-tokens
and I get the same error :
(1/1) MethodNotAllowedHttpException in RouteCollection.php (line 252) at RouteCollection->methodNotAllowed(array('GET', 'HEAD'))in >RouteCollection.php (line 239)
Here is my routes/api.php:
Route::post('access-tokens', 'AuthController@login');
// Register
Route::post('users', 'AuthController@register');
Route::post('recover', 'AuthController@recover');
Route::group(['middleware' => ['jwt.auth']], function() {
Route::delete('access-tokens', 'AuthController@logout');
Route::get('me', function(Request $request) {
return $request->user();
});
Route::post('access-tokens/refresh', 'AuthController@refreshToken');
Route::post('ideas', 'IdeasController@store');
});
Here is the output of php artisan route:list
| | DELETE | api/access-tokens | | App\Http\Controllers\AuthController@logout | api,jwt.auth |
_token
and a_method
field to the request._method
should haveDELETE
as value. - Laertepost
ordelete
, useany
and check the request method inside your controller. - Paul Santos