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')); }
/** * 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)); }
/** * 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)); }