Exemple #1
0
 public function testReturnsNullWhenHeaderNotFound()
 {
     $this->assertNull(Core::header(['headers' => []], 'Foo'));
 }
 public function testDoesNotAddContentTypeByDefault()
 {
     $this->queueRes();
     $handler = new StreamHandler();
     $handler(['http_method' => 'PUT', 'uri' => '/', 'headers' => ['host' => [Server::$host], 'content-length' => [3]], 'body' => 'foo']);
     $req = Server::received()[0];
     $this->assertEquals('', Core::header($req, 'Content-Type'));
     $this->assertEquals(3, Core::header($req, 'Content-Length'));
 }
Exemple #3
0
 public function testSendsPostWithNoBodyOrDefaultContentType()
 {
     Server::flush();
     Server::enqueue([['status' => 200]]);
     $handler = new CurlMultiHandler();
     $response = $handler(['http_method' => 'POST', 'uri' => '/', 'headers' => ['host' => [Server::$host]]]);
     $response->wait();
     $received = Server::received()[0];
     $this->assertEquals('POST', $received['http_method']);
     $this->assertNull(Core::header($received, 'content-type'));
     $this->assertSame('0', Core::firstHeader($received, 'content-length'));
 }