Closed
Description
I'm using postman to test our new API.
Noticed that when i set Accept: application/json
, the API still works. Every other Accept header, not being application/vnd.api+json
, will return a 406 as expected. This should not happen, see https://laraveljsonapi.io/docs/2.0/requests/compliance.html#accept-header.
This is correct:
LaravelJsonApi\Laravel\Http\Requests\ResourceQuery.php
/**
* @var string[]
*/
protected array $mediaTypes = [
self::JSON_API_MEDIA_TYPE,
];
This seems to produce the incorrect result:
/**
* @return bool
*/
protected function isAcceptableMediaType(): bool
{
return $this->accepts($this->mediaTypes());
}
Illuminate\Http\Concerns\InteractsWithContentTypes.php
> matchesType()
assumes application/json
and application/vnd.api+json
are identical.
Metadata
Metadata
Assignees
Labels
No labels