Skip to content

Commit

Permalink
Feature/custom http request headers (#605)
Browse files Browse the repository at this point in the history
* include support for custom http request headers

* format headers key/value pairs

* Update CurlClient.php linting

* remove lingering whitespace
  • Loading branch information
wboereboom authored Jan 9, 2024
1 parent d2aee8b commit c8f030b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Adyen/HttpClient/CurlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,13 @@ public function requestHttp(Service $service, $requestUrl, $params, $method, $re
$libraryVersion
);

// If headers are provided in requestOptions include them in the request
if (!empty($requestOptions['headers'])) {
foreach ($requestOptions['headers'] as $headerKey => $headerValue) {
$headers[] = $headerKey . ': ' . $headerValue;
}
}

// If idempotency key is provided as option include into request
if (!empty($requestOptions['idempotencyKey'])) {
$headers[] = 'Idempotency-Key: ' . $requestOptions['idempotencyKey'];
Expand Down

0 comments on commit c8f030b

Please sign in to comment.