You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 4.4:
Fix CS
[HttpClient][MockHttpClient][DX] Throw when the response factory callable does not return a valid response
[FrameworkBundle] Do not pass the base uri twice to scoped http clients
Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/MockHttpClient.php
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -71,6 +71,10 @@ public function request(string $method, string $url, array $options = []): Respo
71
71
}
72
72
++$this->requestsCount;
73
73
74
+
if (!$responseinstanceof ResponseInterface) {
75
+
thrownewTransportException(sprintf('The response factory passed to MockHttpClient must return/yield an instance of ResponseInterface, "%s" given.', \is_object($response) ? \get_class($response) : \gettype($response)));
[staticfunction (): \Generator { yieldnewMockResponse(); }, 'The response factory passed to MockHttpClient must return/yield an instance of ResponseInterface, "Generator" given.'],
183
+
[staticfunction (): array { return [newMockResponse()]; }, 'The response factory passed to MockHttpClient must return/yield an instance of ResponseInterface, "array" given.'],
184
+
[(staticfunction (): \Generator { yield'ccc'; })(), 'The response factory passed to MockHttpClient must return/yield an instance of ResponseInterface, "string" given.'],
0 commit comments