1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-03-14 19:29:49 +01:00

Dont show curl version in user agent (#2654)

* Dont show curl version in user agent

* Fixed tests

* Add back the fynction

* Drop "version" part

* added version
This commit is contained in:
Tobias Nyholm 2020-05-25 16:40:43 +02:00 committed by GitHub
parent d2db8f533d
commit 41d72a8b32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 17 deletions

View File

@ -107,17 +107,7 @@ final class Utils
*/
public static function defaultUserAgent(): string
{
static $defaultAgent = '';
if (!$defaultAgent) {
$defaultAgent = 'GuzzleHttp/Guzzle';
if (\extension_loaded('curl') && \function_exists('curl_version')) {
$defaultAgent .= ' curl/' . \curl_version()['version'];
}
$defaultAgent .= ' PHP/' . PHP_VERSION;
}
return $defaultAgent;
return sprintf('GuzzleHttp/%d', ClientInterface::MAJOR_VERSION);
}
/**

View File

@ -11,12 +11,6 @@ class FunctionsTest extends TestCase
return [['get'], ['head'], ['delete']];
}
public function testProvidesDefaultUserAgent()
{
$ua = GuzzleHttp\default_user_agent();
self::assertRegExp('#^GuzzleHttp/.+ curl/.+ PHP/.+$#', $ua);
}
public function typeProvider()
{
return [