We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Description
Steps to reproduce the issue:
return new JsonResponse(['key' => $request->get('key')]);
# We don't set any Accept nor Content-Type header curl -d '{"key": "value"} http://domain.tld/path
Describe the results you received:
HTTP/1.1 200 OK {"key": null}
Describe the results you expected:
HTTP/1.1 406 Not Acceptable
Note: Here we consider that we implement HTTP content negociation the right way so the client must provide a Content-Type header.
From where to start
The actual part of JsonBodyListener incrimined code is:
https://github.com/rezzza/symfony-json-rest-api/blob/67639f9383eb4637f6ea56eed136af5373282428/src/JsonBodyListener.php#L34-L40
Other source(s) to watch for inspiration
FOSRestBundle FormatListener.php#L58-L75:
$format = $request->getRequestFormat(null); if (null === $format) { $accept = $this->formatNegotiator->getBest(''); if (null !== $accept && 0.0 < $accept->getQuality()) { $format = $request->getFormat($accept->getValue()); if (null !== $format) { $request->attributes->set('media_type', $accept->getValue()); } } } if (null === $format) { if ($event->getRequestType() === HttpKernelInterface::MASTER_REQUEST) { throw new NotAcceptableHttpException('No matching accepted Response format could be determined'); } return; }
The text was updated successfully, but these errors were encountered:
We need the routing part
Sorry, something went wrong.
ping @tyx I guess this is closed by #21 and #23?
No branches or pull requests
Description
Steps to reproduce the issue:
Describe the results you received:
Describe the results you expected:
HTTP/1.1 406 Not Acceptable
Note: Here we consider that we implement HTTP content negociation the right way so the client must provide a Content-Type header.
From where to start
The actual part of JsonBodyListener incrimined code is:
https://github.com/rezzza/symfony-json-rest-api/blob/67639f9383eb4637f6ea56eed136af5373282428/src/JsonBodyListener.php#L34-L40
Other source(s) to watch for inspiration
FOSRestBundle FormatListener.php#L58-L75:
The text was updated successfully, but these errors were encountered: