8p / EightPointsGuzzleBundle

⛽️ Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony
MIT License
440 stars 71 forks source link

Not possible to override headers in environment config #247

Closed Thomas-Pamono closed 5 years ago

Thomas-Pamono commented 5 years ago
Q A
Symfony version v3.4.8
Bundle version v7.4.0

I'm having issues to override options->headers in environment configurations. I have in config.yml the default configuration which should apply for all envs besides production. (especially important as I have the auth key in the headers)

Unfortunately its using still the config.yaml configuration instead of the one from config_production.yml.

When checking with debug:config I found out that the keys are just added as numerics instead of by their actual key. E.g. I added foobar: "test" in the headers section in staging and I'm getting the following output:

eight_points_guzzle:
    slow_response_time: 1000
    clients:
        abc:
            ...
            options:
                headers:
                    Accept: application/json
                    content-type: application/json
                    x-auth-token: abcdef
                    0: test

while it should show

eight_points_guzzle:
    slow_response_time: 1000
    clients:
        abc:
            ...
            options:
                headers:
                    Accept: application/json
                    content-type: application/json
                    x-auth-token: abcdef
                    foobar: test

I found a similar issue reported in https://github.com/symfony/symfony/issues/18988 where the proposed fix was to use useAttributeAsKey in the treebuilder. Any other ideas or options to achieve to add or override of headers in an environment config?

thanks in advance!

gregurco commented 5 years ago

@Thomas-Pamono thank you for reporting. I was able to repeat the problem. The same issue was with form_params option too. I fixed it and also wrote the test. Could you please check PR #248 ?