Skip to content

Content-Type header not normalized before checking, causing duplication when manually set #420

@noushinfl

Description

@noushinfl

When using @apollo/datasource-rest @6.4.1 the content-type header is conditionally set if not already present. However, the check only looks for 'content-type' in lowercase, while manual settings like 'Content-Type' (capitalized, as commonly written) are not recognized.
This results in two Content-Type headers being sent in the request — one manually set (Content-Type) and one automatically set (content-type), leading to duplicated headers.

Expected Behavior:
The RESTDataSource should normalize existing header keys (case-insensitively) before deciding whether to set content-type.

Impact:

Breaks strict HTTP servers or proxies expecting one Content-Type header

Causes unexpected behaviors in backend systems (e.g., parsing issues)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions