Skip to content

Commit

Permalink
Add valid HTTP protocol 2.0 (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
rancoud authored Sep 2, 2020
1 parent 87f56d7 commit 7d5e097
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Message/MessageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait MessageTrait
protected static string $patternHeaderValue = "@^[ \t\x21-\x7E\x80-\xFF]*$@";

/** @var array */
protected static array $validProtocols = ['0.9', '1.0', '1.1', '2'];
protected static array $validProtocols = ['0.9', '1.0', '1.1', '2', '2.0'];

/** @var array */
protected array $headers = [];
Expand Down
12 changes: 12 additions & 0 deletions tests/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,20 @@ public function testCanConstructWithReason(): void

public function testCanConstructWithProtocolVersion(): void
{
$r = new Response(200, [], null, '0.9');
static::assertSame('0.9', $r->getProtocolVersion());

$r = new Response(200, [], null, '1.0');
static::assertSame('1.0', $r->getProtocolVersion());

$r = new Response(200, [], null, '1.1');
static::assertSame('1.1', $r->getProtocolVersion());

$r = new Response(200, [], null, '2.0');
static::assertSame('2.0', $r->getProtocolVersion());

$r = new Response(200, [], null, '2');
static::assertSame('2', $r->getProtocolVersion());
}

public function testRaiseExceptionConstructWithProtocolVersion(): void
Expand Down

0 comments on commit 7d5e097

Please sign in to comment.