File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -150,15 +150,13 @@ brings most of the available options with type-hinted getters and setters::
150
150
$this->client = $client->withOptions(
151
151
(new HttpOptions())
152
152
->setBaseUri('https://...')
153
+ // Set headers replace *all* headers at once, and deletes the headers you do not provide
153
154
->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')
154
157
->toArray()
155
158
);
156
159
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
160
.. versionadded :: 7.1
163
161
164
162
The :method: `Symfony\\ Component\\ HttpClient\\ HttpOptions::addHeader ` method was introduced in Symfony 7.1.
You can’t perform that action at this time.
0 commit comments