Skip to content

Commit

Permalink
Fixed null body issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kocsismate committed Aug 1, 2015
1 parent d489a74 commit 2ff29a1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/JsonApi/Request/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ class Request implements RequestInterface
*/
public static function fromRequest(ServerRequestInterface $request)
{
$body = json_decode($request->getBody()->getContents(), true);

return new self(
$request->getQueryParams(),
$request->getAttributes(),
json_decode($request->getBody()->getContents(), true)
is_array($body) ? $body : []
);
}

Expand Down

0 comments on commit 2ff29a1

Please sign in to comment.