Open
Description
Hi,
while testing ->preferredFormat() with Chrome I got an ERR_INVALID_SIGNED_EXCHANGE error.
The response had a bad content-type, as it uses the full Accept-Header, e.g.
text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9; charset=UTF-8
Of course, for API requests only sending an Accept-Header like application/xml
or application/json
the original code works.
I needed to merge the fixed xml / json content-types as done in other places in the code:
if (Str::contains($request->headers->get('Accept'), 'xml')) {
return $this->xml($data, $status, array_merge($headers, ['Content-Type' => 'application/xml']), $xmlRoot, $encoding);
}
return $this->json($data, $status, array_merge($headers, ['Content-Type' => 'application/json']));
Thanks for considering the change in the repository.
Metadata
Metadata
Assignees
Labels
No labels