Skip to content
This repository was archived by the owner on Nov 9, 2020. It is now read-only.

Commit d479770

Browse files
committed
Merge branch 'master' into v5.7.7
2 parents bd7376f + 6933910 commit d479770

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ Jobs pushed to the remote queue are transmitted via HTTP and processed on anothe
7272
'url' => 'http://192.168.100.100/api/v1/remote-queue/',
7373
// Token to use for authentication on the remote host.
7474
'token' => 'IoO2l7UKZfso5zQloF2XvAShEbAR5a9M8u+WBfg0HgI=',
75+
// Optional additional request options for the GuzzleHttp client.
76+
'request_options' => [],
7577
]
7678
```
7779

src/RemoteConnector.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,17 @@ class RemoteConnector implements ConnectorInterface
1515
*/
1616
public function connect(array $config)
1717
{
18-
$client = new Client([
19-
'base_uri' => $config['url'],
20-
'headers' => ['Authorization' => "Bearer {$config['token']}"]
21-
]);
18+
$requestOptions = [];
19+
if (isset($config['request_options']) && is_array($config['request_options'])) {
20+
$requestOptions = $config['request_options'];
21+
}
22+
23+
// The URI should not be overridable by custom request options.
24+
$requestOptions['base_uri'] = $config['url'];
25+
26+
$client = new Client(array_merge_recursive($requestOptions, [
27+
'headers' => ['Authorization' => "Bearer {$config['token']}"],
28+
]));
2229

2330
return new RemoteQueue($client, $config['queue']);
2431
}

0 commit comments

Comments
 (0)