示例#1
0
 /**
  * @param int $statusCode
  * @param array $headers
  * @param StreamInterface $body
  */
 public function __construct($statusCode = 200, $reasonPhrase = '', array $headers = [], StreamInterface $body = null)
 {
     $this->validStatusCode($statusCode);
     $this->statusCode = $statusCode;
     $this->reasonPhrase = $this->filterReasonPhrase($statusCode, $reasonPhrase);
     parent::__construct('1.1', $headers, $body);
 }
示例#2
0
 public function testGetBody()
 {
     $mockBody = Mockery::mock(StreamInterface::class);
     // Gets the body of the message.
     $message = new Message('1.0', [], $mockBody);
     $this->assertSame($mockBody, $message->getBody());
     $message = new Message('1.0', []);
     $this->assertNull($message->getBody());
     // return null
 }
示例#3
0
 /**
  * @param string $httpVersion
  * @param string $method
  * @param UriInterface $uri
  * @param array $headers
  * @param StreamInterface $body
  */
 public function __construct($httpVersion, $method = null, UriInterface $uri = null, array $headers = [], StreamInterface $body = null)
 {
     $this->method = $this->filterMethod($method);
     $this->uri = $uri;
     parent::__construct($httpVersion, $headers, $body);
 }