Skip to content

Commit c95633e

Browse files
committed
minor #14907 [HttpClient] [http_client] Fix default headers (danmichaelo)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] [http_client] Fix default headers Fixes a small problem where `headers` are located directly under `http_client`, not under `default_options`. ([config reference](https://symfony.com/doc/current/reference/configuration/framework.html#http-client)) Warning: I'm not familiar with the XML config format, so I'm not entirely sure if I got the XML version correct! Commits ------- 891f771 [http_client] Fix default headers
2 parents e229b93 + 891f771 commit c95633e

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

http_client.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,10 @@ requests and the specific headers for each request:
511511
512512
# config/packages/framework.yaml
513513
framework:
514-
http_client:
515-
headers:
516-
'User-Agent': 'My Fancy App'
514+
default_options:
515+
http_client:
516+
headers:
517+
'User-Agent': 'My Fancy App'
517518
518519
.. code-block:: xml
519520
@@ -528,7 +529,9 @@ requests and the specific headers for each request:
528529
529530
<framework:config>
530531
<framework:http-client>
531-
<framework:header name="User-Agent">My Fancy App</framework:header>
532+
<framework:default-options>
533+
<framework:header name="User-Agent">My Fancy App</framework:header>
534+
</framework:default-options>
532535
</framework-http-client>
533536
</framework:config>
534537
</container>
@@ -538,8 +541,10 @@ requests and the specific headers for each request:
538541
// config/packages/framework.php
539542
$container->loadFromExtension('framework', [
540543
'http_client' => [
541-
'headers' => [
542-
'User-Agent' => 'My Fancy App',
544+
'default_options' => [
545+
'headers' => [
546+
'User-Agent' => 'My Fancy App',
547+
],
543548
],
544549
],
545550
]);

0 commit comments

Comments
 (0)