From b5a2b21a6dcd23ddc5487e3c2b87771ac097add8 Mon Sep 17 00:00:00 2001 From: "Mark J. Becker" Date: Thu, 7 Mar 2024 12:05:00 +0100 Subject: [PATCH] Fix bug in performMonolithGraphQLQuery for API Mesh --- scripts/commerce.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/commerce.js b/scripts/commerce.js index 9c16e58bc2..22559145e5 100644 --- a/scripts/commerce.js +++ b/scripts/commerce.js @@ -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 }, ); }