Skip to content

Commit 6892309

Browse files
Merge pull request #57 from picqer/get-header-info-from-endpoint
Voeg de mogelijkheid toe om (alleen) de headers van een response te verkrijgen.
2 parents 3e34d55 + 0e8b171 commit 6892309

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/BaseClient.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class BaseClient
4747
/** @var ?callable */
4848
private $accessTokenExpiredCallback = null;
4949

50+
private $lastResponseHeaders = null;
51+
5052
/**
5153
* BaseClient constructor.
5254
*/
@@ -375,9 +377,19 @@ public function request(string $method, string $url, array $options, array $resp
375377
}
376378
}
377379

380+
$this->lastResponseHeaders = $response->getHeaders();
381+
378382
return $this->decodeResponse($response, $responseTypes, $url);
379383
}
380384

385+
/**
386+
* @return array|null
387+
*/
388+
public function getLastResponseHeaders(): ?array
389+
{
390+
return $this->lastResponseHeaders;
391+
}
392+
381393
/**
382394
* Validates the existence of the token and its expiration. If the token is expired, the accessTokenExpiredCallback is
383395
* called.

0 commit comments

Comments
 (0)