Skip to content

Commit

Permalink
Merge pull request #120 from mapogolions/enhancement/unnecessary-guard
Browse files Browse the repository at this point in the history
Removed unnecessary validation
  • Loading branch information
l0gicgate committed Aug 8, 2019
2 parents 3b8dc24 + f602cd1 commit 0b3be28
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ public function withAddedHeader($name, $value)
*/
public function withoutHeader($name)
{
Headers::validateHeaderName($name);

$clone = clone $this;
$clone->headers->removeHeader($name);

Expand Down
9 changes: 9 additions & 0 deletions tests/HeadersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ public function testRemoveHeader()
$this->assertEquals([], $headers->getHeaders());
}

/**
* @doesNotPerformAssertions
*/
public function testRemoveHeaderByIncompatibleStringWithRFC()
{
$headers = new Headers();
$headers->removeHeader('<incompatible with RFC>');
}

public function testGetHeader()
{
$headers = new Headers([
Expand Down
11 changes: 11 additions & 0 deletions tests/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ public function testWithoutHeader()
$this->assertEquals($shouldBe, $clone->getHeaders());
}

/**
* @doesNotPerformAssertions
*/
public function testWithoutHeaderByIncompatibleStringWithRFC()
{
$headers = new Headers();
$response = new MessageStub();
$response->headers = $headers;
$response->withoutHeader('<incompatible with RFC');
}

public function testGetBody()
{
$body = $this->getBody();
Expand Down

0 comments on commit 0b3be28

Please sign in to comment.