From 14fd71e82290d4f5bf49ff3a52379f91a54a8a39 Mon Sep 17 00:00:00 2001 From: Franck DAKIA Date: Sun, 5 Nov 2023 15:09:07 +0000 Subject: [PATCH] Fix duplicate headers --- src/Http/Client/HttpClient.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Http/Client/HttpClient.php b/src/Http/Client/HttpClient.php index 6a3945bc..9c94f437 100644 --- a/src/Http/Client/HttpClient.php +++ b/src/Http/Client/HttpClient.php @@ -187,7 +187,9 @@ public function addAttach(string|array $attach): HttpClient public function addHeaders(array $headers): HttpClient { foreach ($headers as $key => $value) { - $this->headers[] = $key . ': ' . $value; + if (!in_array(strtolower($key . ': ' . $value), array_map('strtolower', $this->headers))) { + $this->headers[] = $key . ': ' . $value; + } } return $this;