Skip to content

Commit

Permalink
Add info about the client OS and whether they are on a CI environment…
Browse files Browse the repository at this point in the history
… to each request's user agent string
  • Loading branch information
greg-1-anderson committed Dec 16, 2024
1 parent 353cb73 commit 1108bfd
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/Request/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,11 +464,20 @@ private function getDefaultHeaders()
private function userAgent()
{
$config = $this->getConfig();

$environment_info = [
'php_version' => $config->get('version'),
'script' => $config->get('php_version'),
'os' => PHP_OS,
];

if (getenv('CI')) {
$environment_info['ci'] = '1',
}

return sprintf(
'Terminus/%s (php_version=%s&script=%s)',
$config->get('version'),
$config->get('php_version'),
$config->get('script')
'Terminus/%s (%s)',
explode('&', $environment_info)
);
}

Expand Down

0 comments on commit 1108bfd

Please sign in to comment.