public function testCastsToString()
 {
     $m = new Request('GET', 'http://foo.com');
     $m->setHeader('foo', 'bar');
     $m->setBody(Stream::factory('baz'));
     $this->assertEquals("GET / HTTP/1.1\r\nHost: foo.com\r\nfoo: bar\r\n\r\nbaz", (string) $m);
 }
Пример #2
0
 public function testSetsTransferEncodingChunkedIfNeeded()
 {
     $r = new Request('PUT', '/');
     $s = $this->getMockBuilder('GuzzleHttp5Legacy\\Stream\\StreamInterface')->setMethods(['getSize'])->getMockForAbstractClass();
     $s->expects($this->exactly(2))->method('getSize')->will($this->returnValue(null));
     $r->setBody($s);
     $t = $this->getTrans($r);
     $s = new Prepare();
     $s->onBefore(new BeforeEvent($t));
     $this->assertEquals('chunked', $r->getHeader('Transfer-Encoding'));
 }