Handle no GraphQL variables

This commit is contained in:
Gregory Schier
2024-10-22 08:05:58 -07:00
parent 59b0b7321f
commit ab48f118af
2 changed files with 16 additions and 1 deletions

View File

@@ -52,7 +52,7 @@ export async function pluginHookExport(_ctx: Context, request: Partial<HttpReque
xs.push(NEWLINE);
}
} else if (typeof request.body?.query === 'string') {
const body = { query: request.body.query || '', variables: maybeParseJSON(request.body.variables, {}) };
const body = { query: request.body.query || '', variables: maybeParseJSON(request.body.variables, undefined) };
xs.push('--data-raw', `${quote(JSON.stringify(body))}`);
xs.push(NEWLINE);
} else if (typeof request.body?.text === 'string') {