Merge branch '4.4' into 5.1
* 4.4: Fix tests Remove content-type check on toArray methods
This commit is contained in:
commit
e9d23677a7
@ -143,12 +143,6 @@ trait ResponseTrait
|
|||||||
return $this->jsonData;
|
return $this->jsonData;
|
||||||
}
|
}
|
||||||
|
|
||||||
$contentType = $this->headers['content-type'][0] ?? 'application/json';
|
|
||||||
|
|
||||||
if (!preg_match('/\bjson\b/i', $contentType)) {
|
|
||||||
throw new JsonException(sprintf('Response content-type is "%s" while a JSON-compatible one was expected for "%s".', $contentType, $this->getInfo('url')));
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$content = json_decode($content, true, 512, \JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0));
|
$content = json_decode($content, true, 512, \JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0));
|
||||||
} catch (\JsonException $e) {
|
} catch (\JsonException $e) {
|
||||||
|
@ -41,12 +41,6 @@ class MockResponseTest extends TestCase
|
|||||||
'message' => 'Response body is empty.',
|
'message' => 'Response body is empty.',
|
||||||
];
|
];
|
||||||
|
|
||||||
yield [
|
|
||||||
'content' => '{}',
|
|
||||||
'responseHeaders' => ['content-type' => 'plain/text'],
|
|
||||||
'message' => 'Response content-type is "plain/text" while a JSON-compatible one was expected for "https://example.com/file.json".',
|
|
||||||
];
|
|
||||||
|
|
||||||
yield [
|
yield [
|
||||||
'content' => 'not json',
|
'content' => 'not json',
|
||||||
'responseHeaders' => [],
|
'responseHeaders' => [],
|
||||||
|
Reference in New Issue
Block a user