Skip to content

Commit a2268e9

Browse files
authored
Merge branch 'master' into fix-integration-tests
2 parents 514ff27 + b92ea55 commit a2268e9

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

.github/workflows/integration_tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ jobs:
3131
- name: "caracal"
3232
openstack_version: "stable/2024.1"
3333
ubuntu_version: "22.04"
34-
- name: "bobcat"
35-
openstack_version: "stable/2023.2"
36-
ubuntu_version: "22.04"
3734
- name: "antelope"
3835
openstack_version: "unmaintained/2023.1"
3936
ubuntu_version: "22.04"

src/Common/Api/OperatorTrait.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,13 @@ protected function sendRequest(Operation $operation, array $userValues = [], boo
101101

102102
$uri = Utils::uri_template($operation->getPath(), $userValues);
103103

104-
if (array_key_exists('requestOptions', $userValues)) {
104+
if (isset($userValues['requestOptions'])) {
105105
$options += $userValues['requestOptions'];
106+
107+
// headers are always created in options, merge them
108+
if (isset($userValues['requestOptions']['headers'])) {
109+
$options['headers'] = array_merge($options['headers'], $userValues['requestOptions']['headers']);
110+
}
106111
}
107112

108113
$options['openstack.skip_auth'] = $operation->getSkipAuth();

tests/unit/Common/Api/OperatorTraitTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,30 @@ public function test_guzzle_options_are_forwarded()
111111
'requestOptions' => ['stream' => true],
112112
]);
113113
}
114+
115+
public function test_it_sends_custom_headers_in_request_options()
116+
{
117+
$this->client
118+
->requestAsync('GET', 'test',
119+
[
120+
'headers' => [
121+
'Access-Control-Allow-Origin' => '*',
122+
'Access-Control-Allow-Methods' => 'GET, POST, OPTIONS',
123+
],
124+
'openstack.skip_auth' => false,
125+
])
126+
->shouldBeCalled()
127+
->willReturn(new Promise());
128+
129+
$this->operator->executeAsync($this->def, [
130+
'requestOptions' => [
131+
'headers' => [
132+
'Access-Control-Allow-Origin' => '*',
133+
'Access-Control-Allow-Methods' => 'GET, POST, OPTIONS',
134+
],
135+
],
136+
]);
137+
}
114138
}
115139

116140

0 commit comments

Comments
 (0)