Skip to content

[graphiql] HTTP customized headers are not sent #5538

@orelus

Description

@orelus

API Platform version(s) affected: 3.1.5

Description
When you specify headers in GraphiQL, they are not sent in http headers request.

How to reproduce

Open GraphiQL UI, set a header, open a console with network view, send the request.

image

No Atuhorization header is present.

Possible Solution

Referer to issue graphql/graphiql#3005 (comment), we need to add headers in graphQLFetcher function in file src/Symfony/Bundle/Resources/public/init-graphiql.js.

function graphQLFetcher(graphQLParams, {headers}) {
    return fetch(entrypoint, {
        method: 'post',
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json',
            ...headers
        },

Now the headers are send.

image

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