8000 [HttpClient] HttpClientInterface::withOptions method · symfony/symfony-docs@f447179 · GitHub
[go: up one dir, main page]

Skip to content

Commit f447179

Browse files
0x346e3730javiereguiluz
authored andcommitted
[HttpClient] HttpClientInterface::withOptions method
1 parent 94df07b commit f447179

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

http_client.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,18 @@ You can configure the global options using the ``default_options`` option:
138138
'max_redirects' => 7,
139139
]);
140140
141+
You can also use the :method:`Symfony\\Contracts\\HttpClient\\HttpClientInterface::withOptions`
142+
method to retrieve a new instance of the client with new defaul 8072 t options::
143+
144+
$this->client = $client->withOptions([
145+
'base_uri' => 'https://...',
146+
'headers' => ['header-name' => 'value0, value1, ...']
147+
]);
148+
149+
.. versionadded:: 5.3
150+
151+
The :method:`Symfony\\Contracts\\HttpClient\\HttpClientInterface::withOptions` method was introduced in Symfony 5.3.
152+
141153
Some options are described in this guide:
142154

143155
* `Authentication`_

0 commit comments

Comments
 (0)
0