I used a HTTP client that is able to send a HTTP PUT request. Via a HTML form you are able to send only GET or POST requests, therefore laravel uses the "_method" parameter to handle POST requests like a real PUT/DELETE requests. You may also use a command line tool like curl to send requests with all available HTTP methods. This is only important outside the browser context (API, Webservice).
Inconsistent Redirect method
I think there might be an issue within the Laravel code, but may be I see it wrong, but the redirect response methods seems not consistent to me. I used the following example
$router->put('check', function (\Illuminate\Http\Request $request) {
return redirect('/');
});
$router->put('/', function (\Illuminate\Http\Request $request) {
echo 'PUT';
});
$router->get('/', function (\Illuminate\Http\Request $request) {
echo 'GET';
});
If I'm using a "native" HTTP PUT request (via HTTP client or curl) I will be redirected to "PUT /" , but if I'm using a HTTP POST request with a "_method=put" parameter I'm redirected to "GET /" . Do I expect a wrong behavior or is this an issue within Laravel? I'm using the Laravel Framework Version 5.2.35. I also asked this question at stackoverflow: http://stackoverflow.com/questions/37643770/larvel-inconsistent-redirect-behavior
Seems to be an issue with the behavior of the HTTP clients not a Laravel issue. They may force the request to be redirected with the initially HTTP method.
Please or to participate in this conversation.