Skip to content

Commit 338b850

Browse files
esurovEugene Surov
andauthored
Body decode fix (#140)
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 <eugene.surov@nic.at>
1 parent b05a995 commit 338b850

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ODataResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function __construct($request, $body = null, $httpStatusCode = null, $hea
7676
$this->body = $body;
7777
$this->httpStatusCode = $httpStatusCode;
7878
$this->headers = $headers;
79-
$this->decodedBody = $this->decodeBody();
79+
$this->decodedBody = $this->body ? $this->decodeBody() : [];
8080
}
8181

8282
/**

0 commit comments

Comments
 (0)