Skip to content

Commit

Permalink
[fix] Always set the Content-Type header to application/json
Browse files Browse the repository at this point in the history
Fixes: #669
  • Loading branch information
infiton authored Feb 12, 2025
1 parent 48e23de commit 6cf1b53
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,12 @@ Shopify.prototype.graphql = function graphql(data, variables) {
pathname += '/graphql.json';

const uri = { pathname, ...this.baseUrl };
const json = variables !== undefined && variables !== null;
const options = {
agent: this.options.agent,
body: json ? this.options.stringifyJson({ query: data, variables }) : data,
body: this.options.stringifyJson({ query: data, variables }),
headers: {
...this.baseHeaders,
'Content-Type': json ? 'application/json' : 'application/graphql'
'Content-Type': 'application/json'
},
method: 'POST',
parseJson: this.options.parseJson,
Expand Down

0 comments on commit 6cf1b53

Please sign in to comment.