Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7d0265c

Browse filesBrowse files
committed
Build response header manually
1 parent 0b4a584 commit 7d0265c
Copy full SHA for 7d0265c

File tree

5 files changed

+5
-13
lines changed
Filter options

5 files changed

+5
-13
lines changed

‎src/Symfony/Component/HttpFoundation/Response.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Response.php
+1-9Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public function __construct(?string $content = '', int $status = 200, array $hea
217217
public function __toString(): string
218218
{
219219
return
220-
$this->getCommandString()."\r\n".
220+
sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)."\r\n".
221221
$this->headers."\r\n".
222222
$this->getContent();
223223
}
@@ -230,14 +230,6 @@ public function __clone()
230230
$this->headers = clone $this->headers;
231231
}
232232

233-
/**
234-
* @return string The first line of the actual HTTP request
235-
*/
236-
public function getCommandString(): string
237-
{
238-
return sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText);
239-
}
240-
241233
/**
242234
* Prepares the Response before it is sent to the client.
243235
*

‎src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseIsRedirected.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseIsRedirected.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function additionalFailureDescription($other): string
4949
if ($this->verbose || !($other instanceof Response)) {
5050
return (string) $other;
5151
} else {
52-
return $other->getCommandString()."\r\n".$other->headers;
52+
return explode("\r\n\r\n", (string) $other)[0];
5353
}
5454
}
5555
}

‎src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseIsSuccessful.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseIsSuccessful.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function additionalFailureDescription($other): string
4949
if ($this->verbose || !($other instanceof Response)) {
5050
return (string) $other;
5151
} else {
52-
return $other->getCommandString()."\r\n".$other->headers;
52+
return explode("\r\n\r\n", (string) $other)[0];
5353
}
5454
}
5555
}

‎src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseIsUnprocessable.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseIsUnprocessable.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function additionalFailureDescription($other): string
4949
if ($this->verbose || !($other instanceof Response)) {
5050
return (string) $other;
5151
} else {
52-
return $other->getCommandString()."\r\n".$other->headers;
52+
return explode("\r\n\r\n", (string) $other)[0];
5353
}
5454
}
5555
}

‎src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseStatusCodeSame.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseStatusCodeSame.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function additionalFailureDescription($other): string
4949
if ($this->verbose || !($other instanceof Response)) {
5050
return (string) $other;
5151
} else {
52-
return $other->getCommandString()."\r\n".$other->headers;
52+
return explode("\r\n\r\n", (string) $other)[0];
5353
}
5454
}
5555
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.