Skip to content

Commit b7aa1c1

Browse files
authored
fix: update ua in invoke, not constructor (#423)
1 parent 2a03d9e commit b7aa1c1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Services/EseyeClient.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ public function __construct()
5757
$config->http_client = Client::class;
5858
$config->http_stream_factory = HttpFactory::class;
5959
$config->http_request_factory = HttpFactory::class;
60-
$config->http_user_agent = sprintf('SeAT %s/%s', $version, setting('admin_contact', true));
60+
$config->http_user_agent = sprintf('SeAT %s', $version);
61+
$config->http_user_agent_eveapi_version = $version; //store this for later.
6162

6263
$config->logger = Log::channel('eseye');
6364
$config->cache = Cache::store('eseye');
@@ -190,6 +191,16 @@ public function setBody(array $body): EsiClient
190191
*/
191192
public function invoke(string $method, string $uri, array $uri_data = []): EsiResponse
192193
{
194+
// Here we update the user--agent with contact information.
195+
// At this point it is updating it each call, at the cost
196+
// of a cache request each time. If this proves to impact,
197+
// then in the future we could guard the cache call.
198+
// The benefit to not guarding it is that changes made in
199+
// the UI are appied immediately.
200+
$config = Configuration::getInstance();
201+
$version = $config->http_user_agent_eveapi_version;
202+
$config->http_user_agent = sprintf('SeAT %s/%s', $version, setting('admin_contact', true));
203+
193204
$response = $this->instance->invoke($method, $uri, $uri_data);
194205

195206
return new \Seat\Eveapi\Containers\EsiResponse(

0 commit comments

Comments
 (0)