From 1108bfd0afff3035d6b8e0d3fb485ff6b935558e Mon Sep 17 00:00:00 2001 From: Greg Anderson Date: Mon, 16 Dec 2024 15:40:48 -0800 Subject: [PATCH] Add info about the client OS and whether they are on a CI environment to each request's user agent string --- src/Request/Request.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Request/Request.php b/src/Request/Request.php index 5cd9719c7..03edf336a 100755 --- a/src/Request/Request.php +++ b/src/Request/Request.php @@ -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) ); }