@@ -116,7 +116,7 @@ You can configure the global options using the ``default_options`` option:
116116 <framework : config >
117117 <framework : http-client >
118118 <framework : default-options max-redirects =" 7" />
119- </framework- http-client >
119+ </framework : http-client >
120120 </framework : config >
121121 </container >
122122
@@ -176,7 +176,7 @@ The HTTP client also has one configuration option called
176176 <framework : config >
177177 <framework : http-client max-host-connections =" 10" >
178178 <!-- ... -->
179- </framework- http-client >
179+ </framework : http-client >
180180 </framework : config >
181181 </container >
182182
@@ -495,8 +495,7 @@ associative array via the ``query`` option, that will be merged with the URL::
495495Headers
496496~~~~~~~
497497
498- Use the ``headers `` option to define both the default headers added to all
499- requests and the specific headers for each request:
498+ Use the ``headers `` option to define the default headers added to all requests:
500499
501500.. configuration-block ::
502501
@@ -505,8 +504,9 @@ requests and the specific headers for each request:
505504 # config/packages/framework.yaml
506505 framework :
507506 http_client :
508- headers :
509- ' User-Agent ' : ' My Fancy App'
507+ default_options :
508+ headers :
509+ ' User-Agent ' : ' My Fancy App'
510510
511511 .. code-block :: xml
512512
@@ -521,8 +521,10 @@ requests and the specific headers for each request:
521521
522522 <framework : config >
523523 <framework : http-client >
524- <framework : header name =" User-Agent" >My Fancy App</framework : header >
525- </framework-http-client >
524+ <framework : default-options >
525+ <framework : header name =" User-Agent" >My Fancy App</framework : header >
526+ </framework : default-options >
527+ </framework : http-client >
526528 </framework : config >
527529 </container >
528530
@@ -531,8 +533,10 @@ requests and the specific headers for each request:
531533 // config/packages/framework.php
532534 $container->loadFromExtension('framework', [
533535 'http_client' => [
534- 'headers' => [
535- 'User-Agent' => 'My Fancy App',
536+ 'default_options' => [
537+ 'headers' => [
538+ 'User-Agent' => 'My Fancy App',
539+ ],
536540 ],
537541 ],
538542 ]);
@@ -546,6 +550,8 @@ requests and the specific headers for each request:
546550 ],
547551 ]);
548552
553+ You can also set new headers or override the default ones for specific requests:
554+
549555.. code-block :: php
550556
551557 // this header is only included in this request and overrides the value
@@ -865,7 +871,7 @@ To force HTTP/2 for ``http`` URLs, you need to enable it explicitly via the
865871 <framework : config >
866872 <framework : http-client >
867873 <framework : default-options http-version =" 2.0" />
868- </framework- http-client >
874+ </framework : http-client >
869875 </framework : config >
870876 </container >
871877
0 commit comments