Skip to content

Commit 2336b1b

Browse files
Merge branch '5.1' into 5.x
* 5.1: [Contracts] add branch-aliases for dev-main [Cache] Make Redis initializers static [Messenger] Fixed typos in Connection [CI] Fixed build on AppVeyor Fix tests typo [Lock] Reset Key lifetime time before we acquire it [CI] Silence errors when remove file/dir on test tearDown() Fix tests Remove content-type check on toArray methods
2 parents 175aa2d + 1be53c0 commit 2336b1b

File tree

2 files changed

+0
-12
lines changed

2 files changed

+0
-12
lines changed

Response/CommonResponseTrait.php

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

91-
$contentType = $this->headers['content-type'][0] ?? 'application/json';
92-
93-
if (!preg_match('/\bjson\b/i', $contentType)) {
94-
throw new JsonException(sprintf('Response content-type is "%s" while a JSON-compatible one was expected for "%s".', $contentType, $this->getInfo('url')));
95-
}
96-
9791
try {
9892
$content = json_decode($content, true, 512, \JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0));
9993
} catch (\JsonException $e) {

Tests/Response/MockResponseTest.php

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

57-
yield [
58-
'content' => '{}',
59-
'responseHeaders' => ['content-type' => 'plain/text'],
60-
'message' => 'Response content-type is "plain/text" while a JSON-compatible one was expected for "https://example.com/file.json".',
61-
];
62-
6357
yield [
6458
'content' => 'not json',
6559
'responseHeaders' => [],

0 commit comments

Comments
 (0)