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::
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.
You can’t perform that action at this time.
0 commit comments