Skip to content

Commit 81ecaea

Browse files
committed
Add missing user agent
1 parent a0cf994 commit 81ecaea

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/ConvertKit_API.php

Lines changed: 17 additions & 2 deletions
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');
@@ -368,7 +383,7 @@ public function form_subscribe(int $form_id, array $options)
368383

369384
return $this->post(
370385
sprintf('forms/%s/subscribe', $form_id),
371-
$option
386+
$options
372387
);
373388
}
374389

0 commit comments

Comments
 (0)