Skip to content

Commit efef81b

Browse files
committed
Added a tip about HttpOptions::setHeaders vs HttpOptions::addHeader
Fixes symfony#19236 Not sure of the documentation format. Open to suggestion to improve it :)
1 parent c64e7e7 commit efef81b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

http_client.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@ brings most of the available options with type-hinted getters and setters::
154154
->toArray()
155155
);
156156

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+
162+
.. versionadded:: 7.1
163+
164+
The :method:`Symfony\\Component\\HttpClient\\HttpOptions::addHeader` method was introduced in Symfony 7.1.
165+
157166
Some options are described in this guide:
158167

159168
* `Authentication`_

0 commit comments

Comments
 (0)