diff --git a/src/Connector/Client.php b/src/Connector/Client.php index 7fd419c8..01b51ccc 100644 --- a/src/Connector/Client.php +++ b/src/Connector/Client.php @@ -68,8 +68,9 @@ public function getVersion(): string */ public function modifyOptions(): array { - // Combine options set globally e.g. headers with options set by individual API calls e.g. form_params. - $options = $this->options + $this->requestOptions; + // Combine options set globally e.g. headers with options set by individual API calls e.g. form_params, + // using array_merge_recursive to ensure nested arrays like headers are merged rather than overwritten. + $options = array_merge_recursive($this->requestOptions, $this->options); // This library can be standalone or as a dependency. Dependent libraries may also set their own user agent // which will make $options['headers']['User-Agent'] an array.