I am building an API in Laravel 5.1 to serve a front end application.
I am using the built in Auth routing to serve signup and registration:
$router->controllers(
[
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController'
]
);
Listing the routes shows it comes with a get and post:
POST | 1.0/auth/register/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\AuthController@postRegister | cors |
GET|HEAD | 1.0/auth/register/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\AuthController@getRegister | cors
I only need the post. So I'm testing unique e-mail validation by registering with the same e-mail twice. Instead of throwing a "need unique email" error, it's routing to my GET Register method:
public function getRegister()
{
return view('auth.register');
}
This is bad, because I am not using Laravel's blade, rather I'm using my own Angular frontend. So I get error View [auth.register] not found..
If I remove the GET Register route altogether, the HTTP request still seems to search for a GET and throws error
MethodNotAllowedHttpException in RouteCollection.php line 219:
I'm not sure why this is happening as my frontend HTTP requests are always sent as POST's:
Request URL:http://my-api/1.0/auth/register
Request Method:POST
And I can't find middleware to tell if some re-routing to the GET Register route is happening.
Any thoughts why validation errors may be causing it to route from POST Register to GET Register?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1XQX2fi
via IFTTT
Aucun commentaire:
Enregistrer un commentaire