Skip to content

Commit

Permalink
🔧
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Nov 25, 2023
1 parent 998a1e6 commit c9e79f8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Psr7/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,15 @@ public function withHeader(string $name, $value):static{
* @inheritDoc
*/
public function withAddedHeader(string $name, $value):static{
/** @var array $value */
$value = HeaderUtil::trimValues($this->checkValue($value));
$lcName = strtolower($name);

if(isset($this->headers[$lcName])){
$name = $this->headers[$lcName]['name'];
}

/** @phan-suppress-next-line PhanTypeMismatchArgumentInternal */
$this->headers[$lcName] = ['name' => $name, 'value' => array_merge(($this->headers[$lcName]['value'] ?? []), $value)];

return $this;
Expand Down

0 comments on commit c9e79f8

Please sign in to comment.