Skip to content

Commit 009f6df

Browse files
committed
Add setter for http client
1 parent 564b16c commit 009f6df

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/Client/ModrinthAPIClient.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,18 @@ public function setApiToken(?string $token): static
141141
return $this->setConfiguration($this->configuration);
142142
}
143143

144+
/**
145+
* Set the HTTP client used for all requests.
146+
* When null, the default HTTP client from Guzzle will be used.
147+
* @param ClientInterface|null $httpClient
148+
* @return $this
149+
*/
150+
public function setHttpClient(?ClientInterface $httpClient): static
151+
{
152+
$this->httpClient = $httpClient;
153+
return $this->setConfiguration($this->configuration);
154+
}
155+
144156
/**
145157
* Search projects
146158
* @param ProjectSearchOptions|null $options

0 commit comments

Comments
 (0)