Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/Endpoint/Abstracts/AbstractEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ protected function setResponse(Response $_response): static
/**
* @inheritdoc
*/
public function getResponse(): Response
public function getResponse(): Response|null
{
return $this->_response;
return $this->_response ?? null;
}

public function getResponseBody(bool $associative = true): mixed
Expand Down Expand Up @@ -263,7 +263,10 @@ function (Response $res) use ($options): void {
}
},
function (RequestException $e) use ($options): void {
$this->setResponse($e->getResponse());
$response = $e->getResponse();
if ($response instanceof Response) {
$this->setResponse($response);
}
if (isset($options['error']) && is_callable($options['error'])) {
$options['error']($e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Endpoint/Interfaces/EndpointInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function execute(): static;
/**
* Get the Response Object being used by the Endpoint
*/
public function getResponse(): Response;
public function getResponse(): Response|null;

/**
* Check if authentication should be applied
Expand Down