Skip to content

Commit

Permalink
Build response header manually
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicals committed Feb 4, 2024
1 parent 0b4a584 commit 7d0265c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 13 deletions.
10 changes: 1 addition & 9 deletions src/Symfony/Component/HttpFoundation/Response.php
Expand Up @@ -217,7 +217,7 @@ public function __construct(?string $content = '', int $status = 200, array $hea
public function __toString(): string
{
return
$this->getCommandString()."\r\n".
sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)."\r\n".
$this->headers."\r\n".
$this->getContent();
}
Expand All @@ -230,14 +230,6 @@ public function __clone()
$this->headers = clone $this->headers;
}

/**
* @return string The first line of the actual HTTP request
*/
public function getCommandString(): string
{
return sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText);
}

/**
* Prepares the Response before it is sent to the client.
*
Expand Down
Expand Up @@ -49,7 +49,7 @@ protected function additionalFailureDescription($other): string
if ($this->verbose || !($other instanceof Response)) {
return (string) $other;
} else {
return $other->getCommandString()."\r\n".$other->headers;
return explode("\r\n\r\n", (string) $other)[0];
}
}
}
Expand Up @@ -49,7 +49,7 @@ protected function additionalFailureDescription($other): string
if ($this->verbose || !($other instanceof Response)) {
return (string) $other;
} else {
return $other->getCommandString()."\r\n".$other->headers;
return explode("\r\n\r\n", (string) $other)[0];
}
}
}
Expand Up @@ -49,7 +49,7 @@ protected function additionalFailureDescription($other): string
if ($this->verbose || !($other instanceof Response)) {
return (string) $other;
} else {
return $other->getCommandString()."\r\n".$other->headers;
return explode("\r\n\r\n", (string) $other)[0];
}
}
}
Expand Up @@ -49,7 +49,7 @@ protected function additionalFailureDescription($other): string
if ($this->verbose || !($other instanceof Response)) {
return (string) $other;
} else {
return $other->getCommandString()."\r\n".$other->headers;
return explode("\r\n\r\n", (string) $other)[0];
}
}
}

0 comments on commit 7d0265c

Please sign in to comment.