Skip to content

Commit e83f2b4

Browse files
authored
Merge pull request #34 from ConvertKit/user-agent
Include User Agent header in API requests
2 parents 2619b1b + 064f54c commit e83f2b4

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/ConvertKit_API.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
*/
2020
class ConvertKit_API
2121
{
22+
/**
23+
* The SDK version.
24+
*
25+
* @var string
26+
*/
27+
public const VERSION = '1.0.0';
28+
2229
/**
2330
* ConvertKit API Key
2431
*
@@ -95,7 +102,15 @@ public function __construct(string $api_key, string $api_secret, bool $debug = f
95102
$this->api_key = $api_key;
96103
$this->api_secret = $api_secret;
97104
$this->debug = $debug;
98-
$this->client = new Client();
105+
106+
// Specify a User-Agent for API requests.
107+
$this->client = new Client(
108+
[
109+
'headers' => [
110+
'User-Agent' => 'ConvertKitPHPSDK/' . self::VERSION . ';PHP/' . phpversion(),
111+
],
112+
]
113+
);
99114

100115
if ($debug) {
101116
$this->debug_logger = new Logger('ck-debug');

0 commit comments

Comments
 (0)