Ejemplo n.º 1
0
 public function testWithHeader()
 {
     $message = new Message();
     $message->withHeader('name', 'jan')->withAddedHeader('name', 'janhuang');
     $this->assertEquals(['jan', 'janhuang'], $message->getHeader('name'));
     $this->assertEquals('jan,janhuang', $message->getHeaderLine('name'));
 }
Ejemplo n.º 2
0
 /**
  * Response constructor.
  *
  * @param string $content
  * @param int $statusCode
  * @param array $headers
  */
 public function __construct($content = '', $statusCode = Response::HTTP_OK, array $headers = [])
 {
     $this->withBody(new Stream('php://memory', 'wb+'));
     $this->withStatus($statusCode);
     $this->withContent($content);
     parent::__construct(array_merge(static::HEADERS, $headers));
 }
Ejemplo n.º 3
0
 /**
  * Request constructor.
  *
  * @param $uri
  * @param array $headers
  * @param string $body
  */
 public function __construct($uri, array $headers = [], $body = 'php://memory')
 {
     $this->withUri(new Uri($uri));
     $this->withBody(new Stream($body));
     parent::__construct(array_merge(['USER_AGENT' => static::USER_AGENT], $headers));
 }