diff --git a/src/Transporter/GuzzleHttpTransporter.php b/src/Transporter/GuzzleHttpTransporter.php index 57af769..192eec6 100644 --- a/src/Transporter/GuzzleHttpTransporter.php +++ b/src/Transporter/GuzzleHttpTransporter.php @@ -37,15 +37,16 @@ public function __construct(string $host = '', int $port = 9501, array $config = { parent::__construct($host, $port); - $this->config = array_merge_recursive($config, [ - 'headers' => [ - 'Content-Type' => 'application/json', - 'X-Real-Ip' => $_SERVER['SERVER_ADDR'] ?? '', - 'X-Forwarded-For' => $_SERVER['REMOTE_ADDR'] ?? '', - 'User-Agent' => UserAgent::get(), - ], + $this->config['headers'] = array_replace([ + 'Content-Type' => 'application/json', + 'X-Real-Ip' => $_SERVER['SERVER_ADDR'] ?? '', + 'X-Forwarded-For' => $_SERVER['REMOTE_ADDR'] ?? '', + 'User-Agent' => UserAgent::get(), + ], $config['headers'] ?? []); + $this->config = array_replace([ 'http_errors' => false, - ]); + 'timeout' => $this->timeout, + ], $config); } public function send(string $data)