I am faced with a weird issue where the request body (both parsed and raw string body) is always empty with slim php. I removed all middleware from my code, re-installed composer packages and went as far to just run the hello world example modified as POST request like this:
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
require __DIR__ . '/../vendor/autoload.php';
$app = AppFactory::create();
$app->addRoutingMiddleware();
$errorMiddleware = $app->addErrorMiddleware(true, true, true);
$app->post('/', function (Request $request, Response $response, $args) {
var_dump(file_get_contents('php://input'));
var_dump((string) $request->getBody()));
$response->getBody()->write("Hello");
return $response;
});
$app->run();
In every case the body is empty, I sent raw text, form data and JSON but it does not change. The php input however does have the correct body, just slim seems to be unable to get it at all.