@gianmarx probably because you are not returning any response.. Try this:
$request=$request->all();
return $request;
instead of dd() when making an API call.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have this method which makes the store in the db:
public function storeApi(Request $request)
{
$request=$request->all();
dd($request);
... ..
when I call the api from feature test it gives me empty, let me explain:
$token = 'izjY6Y8fk8y4ztWuagfdaPzaszOvo1ix8ghvApUv9JRjMZP7PR';
$data = [
"title" => [
"en" => "engl",
"fr" => "francese",
"it" => "ital"
],
"body" => [
"en" => "ndncidcdksncsdn",
"fr" => "ndncidcdksncscddddddn",
"it" => "ndncidcdksncscddddddn",
]
];
//check article
$response = $this->withHeaders([
'Content-Type' => 'application/json',
'Authorization' => 'Bearer '.$token,
])->post('/api/store',$data);
//$response is []
if instead I recall the method from api store with insomnia, it prints the data I sent it
I don't understand why the $ response doesn't take the parameters that I send it through post and instead I do it as it should be with insomnia
Please or to participate in this conversation.