Skip to content

Commit 7ef4f8e

Browse files
enhancement set data from response
1 parent 65b68b6 commit 7ef4f8e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ESignBsreResponse.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ public function getErrors()
6363
public function setDataFromResponse(): void
6464
{
6565
if ($this->isSuccess()){
66-
$this->data = $this->response->getBody()->getContents();
66+
if (str_contains(strtolower(implode(" ", $this->response->getHeader('Content-Type'))), strtolower('application/json')))
67+
$this->data = json_decode($this->response->getBody()->getContents());
68+
else
69+
$this->data = $this->response->getBody()->getContents();
6770
}
6871
}
6972

0 commit comments

Comments
 (0)