I am writing Feature Tests for my Laravel Application, where I perform some requests to my service.
While trying to test my API, all GET requests work fine, but all POST requests return this response:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0;url='http://localhost'" />
<title>Redirecting to http://localhost</title>
</head>
<body>
My test code looks like this:
$this->post('api/my/route')->dump();
and my api routes look like this:
Route::prefix('my')->group(function() {
Route::post('/route', function() {
return 'ok';
});
Are there any middleware etc. I might need to change/deactivate before creating a request like this?
These requests work fine when using the web.php
routes
$this->postJson('api/my/route')
? – mare96```html
(not```HTML
)? – Thomas F