Skip to content

[HttpClient] Prevent curl from sending its default Accept and Expect headers #33596

@numerogeek

Description

@numerogeek

Hello,

I am currently dealing with a big account's API, and I figured out that when I send a specific request from POSTMAN it was working, but the very same request failed through the httpClient.

After hours of investigating, I figured out that the httpClient was setting default value for accept and except headers. (cf https://github.com/symfony/http-client/blob/master/CurlHttpClient.php#L245)

Adding the following lines fixed my problem:

 'headers' => [
                'Accept' => '*',
                'Expect' => '*',
]

But I'm wondering why have you coded this in the first place ?

Thank you

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions