Skip to content

Commit 8d869d4

Browse files
committed
Fix the client when used with guzzle 7.9
Guzzle 7.9 introduces stricter checks on the protocol version. This protocol version is configured through the `version` config option. As the whole KeenIOClient config was passed to the instantiated Guzzle Client, this broke things because the version of the keen service was passed to Guzzle as the version config as well, while totally unrelated. The updated logic removes all config options corresponding to the KeenIOClient from the options passed to the Guzzle client.
1 parent 7a89c1b commit 8d869d4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Client/KeenIOClient.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,20 @@ public static function factory($config = array())
7272

7373
$file = 'keen-io-' . str_replace('.', '_', $config['version']) . '.php';
7474

75+
$guzzleClientConfig = $config;
76+
unset(
77+
$guzzleClientConfig['masterKey'],
78+
$guzzleClientConfig['writeKey'],
79+
$guzzleClientConfig['readKey'],
80+
$guzzleClientConfig['projectId'],
81+
$guzzleClientConfig['organizationKey'],
82+
$guzzleClientConfig['organizationId'],
83+
$guzzleClientConfig['version']
84+
);
85+
7586
// Create the new Keen IO Client with our Configuration
7687
return new self(
77-
new Client($config),
88+
new Client($guzzleClientConfig),
7889
new Description(include __DIR__ . "/Resources/{$file}"),
7990
null,
8091
function ($arg) {

0 commit comments

Comments
 (0)