8000 Remove content-type check on toArray methods · symfony/symfony@f6d91ca · GitHub
[go: up one dir, main page]

Skip to content

Commit f6d91ca

Browse files
committed
Remove content-type check on toArray methods
1 parent af8a21f commit f6d91ca

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/Symfony/Component/HttpClient/Response/ResponseTrait.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,6 @@ public function toArray(bool $throw = true): array
143143
return $this->jsonData;
144144
}
145145

146-
$contentType = $this->headers['content-type'][0] ?? 'application/json';
147-
148-
if (!preg_match('/\bjson\b/i', $contentType)) {
149-
throw new JsonException(sprintf('Response content-type is "%s" while a JSON-compatible one was expected for "%s".', $contentType, $this->getInfo('url')));
150-
}
151-
152146
try {
153147
$content = json_decode($content, true, 512, \JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0));
154148
} catch (\JsonException $e) {

0 commit comments

Comments
 (0)
0