Skip to content

Commit edc1971

Browse files
committed
chore: some abstract endpoint refactoring
1 parent ccd0a73 commit edc1971

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Endpoint/AbstractEndpoint.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,12 @@ protected function sendRequest(
7070
{
7171
$this->configurePlugins();
7272

73-
$uri = $this->buildUrl($baseUrl, $query);
74-
$response = $this->httpClientBuilder->getHttpClient()->send($method, $uri, $headers, $body);
73+
$response = $this->httpClientBuilder->getHttpClient()->send(
74+
$method,
75+
$this->buildUrl($baseUrl, $query),
76+
$headers,
77+
$body
78+
);
7579

7680
if (($statusCode = $response->getStatusCode()) >= 400) {
7781
$this->handleResponseErrors($response, $statusCode);
@@ -84,14 +88,13 @@ private function configurePlugins(): void
8488
{
8589
// Plugin order is important
8690
// CachePlugin should come first, otherwise the LoggerPlugin will log requests even if they are cached
91+
8792
if ($this->cache !== null) {
8893
$this->httpClientBuilder->addPlugin(
8994
new CachePlugin($this->cache, $this->httpClientBuilder->getStreamFactory(), [
9095
'default_ttl' => $this->cacheTtl,
9196
'cache_lifetime' => 0,
92-
'cache_listeners' => ($this->logger !== null)
93-
? [new LoggerCacheListener($this->logger)]
94-
: []
97+
'cache_listeners' => ($this->logger !== null) ? [new LoggerCacheListener($this->logger)] : []
9598
])
9699
);
97100
}

0 commit comments

Comments
 (0)