Skip to content

Commit

Permalink
Fix the client when used with guzzle 7.9
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stof committed Aug 2, 2024
1 parent 7a89c1b commit ffb1372
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Client/KeenIOClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ public static function factory($config = array())

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

$guzzleClientConfig = $config;
unset(
$guzzleClientConfig['masterKey'],
$guzzleClientConfig['writeKey'],
$guzzleClientConfig['readKey'],
$guzzleClientConfig['projectId'],
$guzzleClientConfig['organizationKey'],
$guzzleClientConfig['organizationId'],
$guzzleClientConfig['version']
);

// Create the new Keen IO Client with our Configuration
return new self(
new Client($config),
Expand Down

0 comments on commit ffb1372

Please sign in to comment.