mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
Don't render GraphQL comments (Fixes #895)
This commit is contained in:
parent
07b4e02693
commit
4b64c81222
@ -5,6 +5,7 @@ import type { BaseModel } from '../models/index';
|
|||||||
import { setDefaultProtocol } from 'insomnia-url';
|
import { setDefaultProtocol } from 'insomnia-url';
|
||||||
import clone from 'clone';
|
import clone from 'clone';
|
||||||
import * as models from '../models';
|
import * as models from '../models';
|
||||||
|
import { CONTENT_TYPE_GRAPHQL } from '../common/constants';
|
||||||
import * as db from './database';
|
import * as db from './database';
|
||||||
import * as templating from '../templating';
|
import * as templating from '../templating';
|
||||||
import type { CookieJar } from '../models/cookie-jar';
|
import type { CookieJar } from '../models/cookie-jar';
|
||||||
@ -246,6 +247,16 @@ export async function getRenderedRequestAndContext(
|
|||||||
purpose
|
purpose
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// HACK: Remove comments from GraphQL.query because comments (#})
|
||||||
|
// can cause rendering to fail (https://github.com/getinsomnia/insomnia/issues/895)
|
||||||
|
try {
|
||||||
|
if (request.body.text && request.body.mimeType === CONTENT_TYPE_GRAPHQL) {
|
||||||
|
const o = JSON.parse(request.body.text);
|
||||||
|
o.query = o.query.replace(/#}/g, '# }');
|
||||||
|
request.body.text = JSON.stringify(o);
|
||||||
|
}
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
// Render all request properties
|
// Render all request properties
|
||||||
const renderResult = await render(
|
const renderResult = await render(
|
||||||
{ _request: request, _cookieJar: cookieJar },
|
{ _request: request, _cookieJar: cookieJar },
|
||||||
|
@ -247,7 +247,6 @@ export function createWindow() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Insomnia Help',
|
label: 'Insomnia Help',
|
||||||
accelerator: 'CmdOrCtrl+/',
|
|
||||||
click: () => {
|
click: () => {
|
||||||
shell.openExternal('https://support.insomnia.rest');
|
shell.openExternal('https://support.insomnia.rest');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user