Skip to content

Commit

Permalink
Body decode fix (#140)
Browse files Browse the repository at this point in the history
In case of empty body (e.g. `HTTP 204` for DELETE). This `decodeBody`
regex fails and throws an error. The fix is to NOT decode an empty body.

Co-authored-by: Eugene Surov <[email protected]>
  • Loading branch information
esurov and Eugene Surov authored Sep 1, 2023
1 parent b05a995 commit 338b850
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ODataResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function __construct($request, $body = null, $httpStatusCode = null, $hea
$this->body = $body;
$this->httpStatusCode = $httpStatusCode;
$this->headers = $headers;
$this->decodedBody = $this->decodeBody();
$this->decodedBody = $this->body ? $this->decodeBody() : [];
}

/**
Expand Down

0 comments on commit 338b850

Please sign in to comment.