Skip to content

Commit

Permalink
Dont show curl version in user agent (#2654)
Browse files Browse the repository at this point in the history
* Dont show curl version in user agent

* Fixed tests

* Add back the fynction

* Drop "version" part

* added version
  • Loading branch information
Nyholm committed May 25, 2020
1 parent d2db8f5 commit 41d72a8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
12 changes: 1 addition & 11 deletions src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,7 @@ public static function chooseHandler(): callable
*/
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);
}

/**
Expand Down
6 changes: 0 additions & 6 deletions tests/functionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ public function noBodyProvider()
return [['get'], ['head'], ['delete']];
}

public function testProvidesDefaultUserAgent()
{
$ua = GuzzleHttp\default_user_agent();
self::assertRegExp('#^GuzzleHttp/.+ curl/.+ PHP/.+$#', $ua);
}

public function typeProvider()
{
return [
Expand Down

0 comments on commit 41d72a8

Please sign in to comment.