From ab48f118af3988e70859fdb37afa69c9cbe509d1 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Tue, 22 Oct 2024 08:05:58 -0700 Subject: [PATCH] Handle no GraphQL variables --- plugins/exporter-curl/src/index.ts | 2 +- plugins/exporter-curl/tests/index.test.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/plugins/exporter-curl/src/index.ts b/plugins/exporter-curl/src/index.ts index 3c21682f..c4f06a02 100644 --- a/plugins/exporter-curl/src/index.ts +++ b/plugins/exporter-curl/src/index.ts @@ -52,7 +52,7 @@ export async function pluginHookExport(_ctx: Context, request: Partial { ); }); + test('Exports POST with GraphQL data no variables', async () => { + expect( + await pluginHookExport(ctx, { + url: 'https://yaak.app', + method: 'POST', + bodyType: 'graphql', + body: { + query : '{foo,bar}', + }, + }), + ).toEqual( + [`curl -X POST 'https://yaak.app'`, `--data-raw '{"query":"{foo,bar}"}'`].join(` \\\n `), + ); + }); + test('Exports PUT with multipart form', async () => { expect( await pluginHookExport(ctx, {