Closed krowinski closed 5 months ago
No tests and no real explanation of how to recreate the issue this is supposed to fix.
@taylorotwell
Create route
Route::post('/test', static function (Request $request) {
return new JsonResponse($request->get('key'));
});
Post json
curl --location 'localhost/test/' \
--header 'Content-Type: application/json' \
--data '{"key":"value"}'
Expected "value"
Current "{}"
Laravel is using $response = $kernel->handle($request = Request::capture())->send();
in index.php but FrankenPhpClient is just doing Request::createFromGlobals() and its not passing by \Illuminate\Http\Request::createFromBase that populate request using incoming json values using this code fragment.
if ($newRequest->isJson()) {
$newRequest->request = $newRequest->json();
}
Request::capture is using createFromBase that checks is request is json and replace request with json array
and later when in controller you can use request->get('some-json-key') to get value as its a default laravel behavior [check index.php:53]