Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ jobs:
- name: "caracal"
openstack_version: "stable/2024.1"
ubuntu_version: "22.04"
- name: "bobcat"
openstack_version: "stable/2023.2"
ubuntu_version: "22.04"
- name: "antelope"
openstack_version: "unmaintained/2023.1"
ubuntu_version: "22.04"
Expand Down
7 changes: 6 additions & 1 deletion src/Common/Api/OperatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,13 @@ protected function sendRequest(Operation $operation, array $userValues = [], boo

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

if (array_key_exists('requestOptions', $userValues)) {
if (isset($userValues['requestOptions'])) {
$options += $userValues['requestOptions'];

// headers are always created in options, merge them
if (isset($userValues['requestOptions']['headers'])) {
$options['headers'] = array_merge($options['headers'], $userValues['requestOptions']['headers']);
}
}

$options['openstack.skip_auth'] = $operation->getSkipAuth();
Expand Down
24 changes: 24 additions & 0 deletions tests/unit/Common/Api/OperatorTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,30 @@ public function test_guzzle_options_are_forwarded()
'requestOptions' => ['stream' => true],
]);
}

public function test_it_sends_custom_headers_in_request_options()
{
$this->client
->requestAsync('GET', 'test',
[
'headers' => [
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => 'GET, POST, OPTIONS',
],
'openstack.skip_auth' => false,
])
->shouldBeCalled()
->willReturn(new Promise());

$this->operator->executeAsync($this->def, [
'requestOptions' => [
'headers' => [
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => 'GET, POST, OPTIONS',
],
],
]);
}
}


Expand Down
Loading