Skip to content

Commit 23c7c64

Browse files
authored
fix(symfony): handle empty content-type as set by Symfony (#6078)
* fix: requests with an empty content type In PHP, requests without content-type will result in a content-type header containing an empty string, not null * test: add tests for content type containing an empty string * test: added a test for DeserializeListener
1 parent d5b715b commit 23c7c64

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

EventListener/DeserializeListener.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private function getFormat(Request $request, array $formats): string
132132
{
133133
/** @var ?string $contentType */
134134
$contentType = $request->headers->get('CONTENT_TYPE');
135-
if (null === $contentType) {
135+
if (null === $contentType || '' === $contentType) {
136136
throw new UnsupportedMediaTypeHttpException('The "Content-Type" header must exist.');
137137
}
138138

0 commit comments

Comments
 (0)