Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQL query error with API version 2025-01 (Unsupported Content-Type header) #338

Open
shevabam opened this issue Dec 27, 2024 · 0 comments

Comments

@shevabam
Copy link

Hello,
With Shopify API version 2025-01, calling a GraphQL query no longer works:

Unsupported Content-Type header, use application/json

Indeed, since 2025-01, the Content-Type header application/graphql is deprecated (https://shopify.dev/changelog/content-type-application-graphql-is-deprecated).

In the file HttpRequestGraphQL.php, line 53, the Content-Type is forced to application/graphql.

It works fine by removing the if/else and putting only:

self::$postDataGraphQL = json_encode(['query' => $data, 'variables' => $variables]);
self::$httpHeaders['Content-type'] = 'application/json';

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant