Skip to content

Commit

Permalink
feat: include operationName to rawRequest payload if defined in gql (#…
Browse files Browse the repository at this point in the history
…328)

Co-authored-by: dadajian <[email protected]>
  • Loading branch information
danadajian and dadajian committed Feb 22, 2022
1 parent 26711e7 commit 24ca53b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ export class GraphQLClient {
fetchOptions.signal = rawRequestOptions.signal
}

const { operationName } = resolveRequestDocument(rawRequestOptions.query)

return makeRequest<T, V>({
url,
query: rawRequestOptions.query,
Expand All @@ -227,7 +229,7 @@ export class GraphQLClient {
...resolveHeaders(headers),
...resolveHeaders(rawRequestOptions.requestHeaders),
},
operationName: undefined,
operationName,
fetch,
method,
fetchOptions,
Expand Down

0 comments on commit 24ca53b

Please sign in to comment.