Skip to content

Commit a3dfa35

Browse files
feat(http-client): Set User-Agent header dynamically
This commit updates the HTTP client code to set the 'User-Agent' header dynamically based on the SDK version. The User-Agent now follows the format 'FlutterwavePHP/{SDK_VERSION}', where {SDK_VERSION} is the version of the SDK obtained from the EnvVariables class.This change improves the clarity of user-agent information for HTTP requests, helping with tracking and debugging.
1 parent 16e9f8a commit a3dfa35

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Config/AbstractConfig.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ protected function __construct(string $secret_key, string $public_key, string $e
4343
[
4444
'base_uri' => EnvVariables::BASE_URL,
4545
'timeout' => 60,
46-
RequestOptions::VERIFY => \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath()
46+
'headers' => ['User-Agent' => sprintf(
47+
'FlutterwavePHP/%d', EnvVariables::SDK_VERSION
48+
)],
49+
RequestOptions::VERIFY =>
50+
\Composer\CaBundle\CaBundle::getSystemCaRootBundlePath()
4751
]
4852
);
4953

0 commit comments

Comments
 (0)