There is a problem occurring while using APIs with trailing slash.
Route
Route::post('user/register','UserController@register');
It's working fine when I called this route POST
from the postman/website, but I called this route from mobile with a trailing slash like the following.
user/register/
Laravel, by default, remove the trailing slash but make the request as GET
when I dump the request method.
$method = $_SERVER['REQUEST_METHOD'];
$json = json_encode(['response' => $method], true);
result -> "{response : 'GET'}"
And I am unable to fetch the request body.
NOTE: I have tried many solutions but couldn't find any solution, and also, I can't remove or update route calling from the mobile end, so I have to handle it on the server-side.