public function __construct($body = 'php://memory', $status = 200, array $headers = [])
{
if (!is_string($body) && !is_resource($body) && !$body instanceof StreamInterface) {
throw new InvalidArgumentException('Stream must be a string stream resource identifier, ' . 'an actual stream resource, ' . 'or a Psr\\Http\\Message\\StreamInterface implementation');
}
if (null !== $status) {
$this->validateStatus($status);
}
$this->stream = $body instanceof StreamInterface ? $body : new Stream($body, 'wb+');
$this->statusCode = $status ? (int) $status : 200;
list($this->headerNames, $headers) = $this->filterHeaders($headers);
$this->assertHeaders($headers);
$this->headers = $headers;
}