From 5704174fe635031209837cf4bd42d2eb17bb445d Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Fri, 22 Nov 2019 11:15:27 +0100 Subject: [PATCH] MessageTrait: Fixed HeaderBag::get parameter deprecation in Symfony 4.4 --- src/Http/MessageTrait.php | 2 +- tests/Unit/Http/MessageTraitResponseTest.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Http/MessageTrait.php b/src/Http/MessageTrait.php index 93c7cd50..a835ba0e 100644 --- a/src/Http/MessageTrait.php +++ b/src/Http/MessageTrait.php @@ -111,7 +111,7 @@ trait MessageTrait */ public function getHeader($name) { - return $this->headers->get($name, null, false); + return $this->headers->all($name); } /** diff --git a/tests/Unit/Http/MessageTraitResponseTest.php b/tests/Unit/Http/MessageTraitResponseTest.php index 33e8dc6b..8ced6560 100644 --- a/tests/Unit/Http/MessageTraitResponseTest.php +++ b/tests/Unit/Http/MessageTraitResponseTest.php @@ -74,6 +74,11 @@ class MessageTraitResponseTest extends TestCase $this->assertEquals(['bar'], $newMessage->getHeader('Foo')); $this->assertEquals([], $newMessage->getHeader('LoremIpsum')); + + $newMessage = $message + ->withHeader('foo', 'bar') + ->withAddedHeader('foo', 'batz'); + $this->assertEquals(['bar', 'batz'], $newMessage->getHeader('foo')); } /**