Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit b459be7

Browse files
committed
Fixing issue #100 withHeader does not remove old header value
1 parent 90f5cf9 commit b459be7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/MessageTrait.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ public function withHeader($header, $value)
204204
$normalized = strtolower($header);
205205

206206
$new = clone $this;
207+
if($new->hasHeader($header)) {
208+
unset($new->headers[$new->headerNames[$normalized]]);
209+
}
207210
$new->headerNames[$normalized] = $header;
208211
$new->headers[$header] = $value;
209212

0 commit comments

Comments
 (0)