47 if (empty($this->headers)) {
48 throw new \RuntimeException(
'No headers have been received');
52 $startLine = explode(
' ', array_shift($this->headers), 3);
53 $headers = \GuzzleHttp\headers_from_lines($this->headers);
54 $normalizedKeys = \GuzzleHttp\normalize_header_keys(
$headers);
56 if (!empty($this->options[
'decode_content'])
57 && isset($normalizedKeys[
'content-encoding'])
59 $headers[
'x-encoded-content-encoding']
60 =
$headers[$normalizedKeys[
'content-encoding']];
61 unset(
$headers[$normalizedKeys[
'content-encoding']]);
62 if (isset($normalizedKeys[
'content-length'])) {
64 =
$headers[$normalizedKeys[
'content-length']];
66 $bodyLength = (int) $this->sink->getSize();
68 $headers[$normalizedKeys[
'content-length']] = $bodyLength;
70 unset(
$headers[$normalizedKeys[
'content-length']]);
76 $this->response =
new Response(
80 substr($startLine[0], 5),
81 isset($startLine[2]) ? (
string) $startLine[2] :
null
85 public function __get($name)
87 $msg = $name ===
'handle'
88 ?
'The EasyHandle has been released'
89 :
'Invalid property: ' . $name;
90 throw new \BadMethodCallException($msg);