Skip to content

Commit

Permalink
Merge pull request #278 from bowphp/fix-http-duplicate-header
Browse files Browse the repository at this point in the history
Fix duplicate headers
  • Loading branch information
papac authored Nov 5, 2023
2 parents 1ae3725 + 14fd71e commit 5bae292
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Http/Client/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5bae292

Please sign in to comment.