diff --git a/src/Server/Helper.php b/src/Server/Helper.php index 8bc8588..1957fec 100644 --- a/src/Server/Helper.php +++ b/src/Server/Helper.php @@ -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(); diff --git a/tests/Server/RequestParsingTest.php b/tests/Server/RequestParsingTest.php index be49492..49f32fb 100644 --- a/tests/Server/RequestParsingTest.php +++ b/tests/Server/RequestParsingTest.php @@ -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() ); }