Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

Commit59f7564

Browse files
committed
[HttpClient] Add method to set response factory in mock client
1 parentea5b632 commit59f7564

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

‎src/Symfony/Component/HttpClient/CHANGELOG.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
5.4
5+
---
6+
7+
* Add`MockHttpClient::setResponseFactory()` method to be able to set response factory after client creating
8+
49
5.3
510
---
611

‎src/Symfony/Component/HttpClient/MockHttpClient.php‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ class MockHttpClient implements HttpClientInterface
3535
* @param callable|callable[]|ResponseInterface|ResponseInterface[]|iterable|null $responseFactory
3636
*/
3737
publicfunction__construct($responseFactory =null, ?string$baseUri ='https://example.com')
38+
{
39+
$this->setResponseFactory($responseFactory);
40+
$this->defaultOptions['base_uri'] =$baseUri;
41+
}
42+
43+
/**
44+
* @param callable|callable[]|ResponseInterface|ResponseInterface[]|iterable|null $responseFactory
45+
*/
46+
publicfunctionsetResponseFactory($responseFactory)
3847
{
3948
if ($responseFactoryinstanceof ResponseInterface) {
4049
$responseFactory = [$responseFactory];
@@ -47,7 +56,6 @@ public function __construct($responseFactory = null, ?string $baseUri = 'https:/
4756
}
4857

4958
$this->responseFactory =$responseFactory;
50-
$this->defaultOptions['base_uri'] =$baseUri;
5159
}
5260

5361
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp