Skip to content

Commit fb64d7f

Browse files
committed
Updated documentation according to review suggestions
1 parent efef81b commit fb64d7f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

http_client.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,13 @@ brings most of the available options with type-hinted getters and setters::
150150
$this->client = $client->withOptions(
151151
(new HttpOptions())
152152
->setBaseUri('https://...')
153+
// Set headers replace *all* headers at once, and deletes the headers you do not provide
153154
->setHeaders(['header-name' => 'header-value'])
155+
// Alternatively, add or replace only one header to an existing HttpOptions object.
156+
->addHeader('another-header-name', 'another-header-value')
154157
->toArray()
155158
);
156159

157-
.. tip::
158-
159-
Be aware that calling :method:`Symfony\\Component\\HttpClient\\HttpOptions::setHeaders` overrides all previous headers.
160-
If you intend to add or replace only one header, use :method:`Symfony\\Component\\HttpClient\\HttpOptions::addHeader` instead.
161-
162160
.. versionadded:: 7.1
163161

164162
The :method:`Symfony\\Component\\HttpClient\\HttpOptions::addHeader` method was introduced in Symfony 7.1.

0 commit comments

Comments
 (0)