diff --git a/plugins/exporter-curl/src/index.ts b/plugins/exporter-curl/src/index.ts index 97814c82..5fdbdaf7 100644 --- a/plugins/exporter-curl/src/index.ts +++ b/plugins/exporter-curl/src/index.ts @@ -51,9 +51,12 @@ export async function pluginHookExport(_ctx: Context, request: Partial { ); }); + test('Exports POST with GraphQL data', async () => { + expect( + await pluginHookExport(ctx, { + url: 'https://yaak.app', + method: 'POST', + bodyType: 'graphql', + body: { + query : '{foo,bar}', + variables: {a: 'aaa', b: 'bbb'}, + }, + }), + ).toEqual( + [`curl -X POST 'https://yaak.app'`, `--data-raw '{"query":"{foo,bar}","variables":{"a":"aaa","b":"bbb"}}'`].join(` \\\n `), + ); + }); + test('Exports PUT with multipart form', async () => { expect( await pluginHookExport(ctx, { @@ -78,7 +94,7 @@ describe('exporter-curl', () => { [ `curl -X POST 'https://yaak.app'`, `--header 'Content-Type: application/json'`, - `--data-raw $'{"foo":"bar\\'s"}'`, + `--data-raw '{"foo":"bar\\'s"}'`, ].join(` \\\n `), ); }); @@ -98,7 +114,7 @@ describe('exporter-curl', () => { [ `curl -X POST 'https://yaak.app'`, `--header 'Content-Type: application/json'`, - `--data-raw $'{"foo":"bar",\n"baz":"qux"}'`, + `--data-raw '{"foo":"bar",\n"baz":"qux"}'`, ].join(` \\\n `), ); });