Skip to content

Commit

Permalink
Fix bug in performMonolithGraphQLQuery for API Mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
herzog31 committed Mar 7, 2024
1 parent d72caf2 commit b5a2b21
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions scripts/commerce.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,11 @@ export async function performMonolithGraphQLQuery(query, variables, GET = true,
}),
});
} else {
const params = new URLSearchParams({
query: query.replace(/(?:\r\n|\r|\n|\t|[\s]{4})/g, ' ').replace(/\s\s+/g, ' '),
variables: JSON.stringify(variables),
});
const endpoint = new URL(GRAPHQL_ENDPOINT);
endpoint.searchParams.set('query', query.replace(/(?:\r\n|\r|\n|\t|[\s]{4})/g, ' ').replace(/\s\s+/g, ' '));
endpoint.searchParams.set('variables', JSON.stringify(variables));
response = await fetch(
`${GRAPHQL_ENDPOINT}?${params.toString()}`,
endpoint.toString(),
{ headers },
);
}
Expand Down

0 comments on commit b5a2b21

Please sign in to comment.