Skip to content

[HttpClient] Configure MockClient if mock_response_factory has been set on a scoped client #52265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: 7.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix test
  • Loading branch information
tarjei committed May 10, 2024
commit 12fab44c9a8f320947d9c49c708f7017a1e9a6d6
Original file line number Diff line number Diff line change
Expand Up @@ -1864,15 +1864,17 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode, callable $e
->info('Rate limiter name to use for throttling requests')
->end()
->append($this->createHttpClientRetrySection())
->booleanNode('mock_client')
->info('Inject a mock client.')
->defaultFalse()
->end()
->scalarNode('mock_response_factory')
->defaultNull()
->info('The id of the service that should generate mock responses. It should be either an invokable or an iterable. Requires mock_client = true')
->end()
->end()
->end()
->booleanNode('mock_client')
->info('Inject a mock client.')
->end()
->scalarNode('mock_response_factory')
->defaultNull()
->info('The id of the service that should generate mock responses. It should be either an invokable or an iterable. Requires mock_client = true')
->end()

->arrayNode('scoped_clients')
->useAttributeAsKey('name')
->normalizeKeys(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ public function testScopedHttpClientsInheritRateLimiterAndRetryFailedConfigurati

$config = $processor->processConfiguration($configuration, [[
'http_client' => [
'default_options' => ['rate_limiter' => 'default_limiter', 'retry_failed' => ['max_retries' => 77]],
'default_options' => ['rate_limiter' => 'default_limiter', 'retry_failed' => ['max_retries' => 77], 'mock_response_factory' => null, 'mock_client' => false],
'scoped_clients' => [
'foo' => ['base_uri' => 'http://example.com'],
'bar' => ['base_uri' => 'http://example.com', 'rate_limiter' => true, 'retry_failed' => true],
Expand Down
Loading