mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-22 04:46:04 +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)
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($bodyParams)) {
|
||||
throw new InvariantViolation(
|
||||
"PSR-7 request is expected to provide parsed body for \"application/json\" requests but got empty array"
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$bodyParams = $request->getParsedBody();
|
||||
|
||||
|
@ -177,12 +177,12 @@ class RequestParsingTest extends \PHPUnit_Framework_TestCase
|
||||
public function testFailsParsingNonPreParsedPsrRequest()
|
||||
{
|
||||
try {
|
||||
$this->parsePsrRequest('application/json', json_encode([]));
|
||||
$this->parsePsrRequest('application/json', json_encode(null));
|
||||
$this->fail('Expected exception not thrown');
|
||||
} catch (InvariantViolation $e) {
|
||||
// Expecting parsing exception to be thrown somewhere else:
|
||||
$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()
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user