Reputation: 45
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 |
Upvotes: 0
Views: 710
Reputation: 45
The problem was in my controller..commented one line and it works! Thank you all
Upvotes: 0
Reputation: 1132
You are posting your data as GET, try add method field
{{ method_field('DELETE') }}
Upvotes: 0