You are here

public function FunctionsTest::testParsesRequestMessages in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/psr7/tests/FunctionsTest.php \GuzzleHttp\Tests\Psr7\FunctionsTest::testParsesRequestMessages()

File

vendor/guzzlehttp/psr7/tests/FunctionsTest.php, line 238

Class

FunctionsTest

Namespace

GuzzleHttp\Tests\Psr7

Code

public function testParsesRequestMessages() {
  $req = "GET /abc HTTP/1.0\r\nHost: foo.com\r\nFoo: Bar\r\nBaz: Bam\r\nBaz: Qux\r\n\r\nTest";
  $request = Psr7\parse_request($req);
  $this
    ->assertEquals('GET', $request
    ->getMethod());
  $this
    ->assertEquals('/abc', $request
    ->getRequestTarget());
  $this
    ->assertEquals('1.0', $request
    ->getProtocolVersion());
  $this
    ->assertEquals('foo.com', $request
    ->getHeaderLine('Host'));
  $this
    ->assertEquals('Bar', $request
    ->getHeaderLine('Foo'));
  $this
    ->assertEquals('Bam, Qux', $request
    ->getHeaderLine('Baz'));
  $this
    ->assertEquals('Test', (string) $request
    ->getBody());
  $this
    ->assertEquals('http://foo.com/abc', (string) $request
    ->getUri());
}