mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-25 14:26:08 +03:00
Fixed PSR request parsing, broken after recent changes
This commit is contained in:
parent
918bbff2bd
commit
4f223ba11d
@ -499,12 +499,6 @@ class Helper
|
|||||||
Utils::printSafeJson($bodyParams)
|
Utils::printSafeJson($bodyParams)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($bodyParams)) {
|
|
||||||
throw new InvariantViolation(
|
|
||||||
"PSR-7 request is expected to provide parsed body for \"application/json\" requests but got empty array"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$bodyParams = $request->getParsedBody();
|
$bodyParams = $request->getParsedBody();
|
||||||
|
|
||||||
|
@ -177,12 +177,12 @@ class RequestParsingTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testFailsParsingNonPreParsedPsrRequest()
|
public function testFailsParsingNonPreParsedPsrRequest()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->parsePsrRequest('application/json', json_encode([]));
|
$this->parsePsrRequest('application/json', json_encode(null));
|
||||||
$this->fail('Expected exception not thrown');
|
$this->fail('Expected exception not thrown');
|
||||||
} catch (InvariantViolation $e) {
|
} catch (InvariantViolation $e) {
|
||||||
// Expecting parsing exception to be thrown somewhere else:
|
// Expecting parsing exception to be thrown somewhere else:
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'PSR-7 request is expected to provide parsed body for "application/json" requests but got empty array',
|
'PSR-7 request is expected to provide parsed body for "application/json" requests but got null',
|
||||||
$e->getMessage()
|
$e->getMessage()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user