Skip to content

Commit 4a28c46

Browse files
committed
Allow Mock Handler
1 parent 188f7e7 commit 4a28c46

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/NewTwitchApi/HelixGuzzleClient.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,21 @@ public function __construct(string $clientId, array $config = [], string $baseUr
1919

2020
$headers = [
2121
'Client-ID' => $clientId,
22+
'Accept' => 'application/json',
2223
];
2324

24-
$this->client = new Client([
25+
$client_config = [
2526
'base_uri' => $baseUri,
2627
'headers' => $headers,
27-
'Accept' => 'application/json',
28-
]);
28+
];
29+
30+
if (isset($config['handler'])) {
31+
$client_config = [];
32+
}
33+
34+
$client_config = array_merge($client_config, $config);
35+
36+
$this->client = new Client($client_config);
2937
}
3038

3139
public static function getClient(string $clientId, array $config = []): Client

0 commit comments

Comments
 (0)