8000 Merge branch '4.4' into 5.1 · symfony/symfony@e9d2367 · GitHub
[go: up one dir, main page]

Skip to content

Commit e9d2367

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Fix tests Remove content-type check on toArray methods
2 parents 60d1ac9 + 1549897 commit e9d2367

File tree

2 files changed

+0
-12
lines changed

2 files changed

+0
-12
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) {

src/Symfony/Component/HttpClient/Tests/Response/MockResponseTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ public function toArrayErrors()
4141
'message' => 'Response body is empty.',
4242
];
4343

44-
yield [
45-
'content' => '{}',
46-
'responseHeaders' => ['content-type' => 'plain/text'],
47-
'message' => 'Response content-type is "plain/text" while a JSON-compatible one was expected for "https://example.com/file.json".',
48-
];
49-
5044
yield [
5145
'content' => 'not json',
5246
'responseHeaders' => [],

0 commit comments

Comments
 (0)
0