mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
Automatically switch to POST for GraphQL
This commit is contained in:
parent
7b494c2b95
commit
4006c25532
@ -1,6 +1,6 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import type {BaseModel} from './index';
|
import type {BaseModel} from './index';
|
||||||
import {AUTH_BASIC, AUTH_DIGEST, AUTH_NONE, AUTH_NTLM, AUTH_OAUTH_2, AUTH_AWS_IAM, AUTH_NETRC, CONTENT_TYPE_FILE, CONTENT_TYPE_FORM_DATA, CONTENT_TYPE_FORM_URLENCODED, CONTENT_TYPE_OTHER, getContentTypeFromHeaders, METHOD_GET, CONTENT_TYPE_GRAPHQL, CONTENT_TYPE_JSON} from '../common/constants';
|
import {AUTH_BASIC, AUTH_DIGEST, AUTH_NONE, AUTH_NTLM, AUTH_OAUTH_2, AUTH_AWS_IAM, AUTH_NETRC, CONTENT_TYPE_FILE, CONTENT_TYPE_FORM_DATA, CONTENT_TYPE_FORM_URLENCODED, CONTENT_TYPE_OTHER, getContentTypeFromHeaders, METHOD_GET, CONTENT_TYPE_GRAPHQL, CONTENT_TYPE_JSON, METHOD_POST} from '../common/constants';
|
||||||
import * as db from '../common/database';
|
import * as db from '../common/database';
|
||||||
import {getContentTypeHeader} from '../common/misc';
|
import {getContentTypeHeader} from '../common/misc';
|
||||||
import {buildFromParams, deconstructToParams} from '../common/querystring';
|
import {buildFromParams, deconstructToParams} from '../common/querystring';
|
||||||
@ -214,6 +214,11 @@ export function updateMimeType (
|
|||||||
? CONTENT_TYPE_JSON
|
? CONTENT_TYPE_JSON
|
||||||
: mimeType;
|
: mimeType;
|
||||||
|
|
||||||
|
// GraphQL must be POST
|
||||||
|
if (mimeType === CONTENT_TYPE_GRAPHQL) {
|
||||||
|
request.method = METHOD_POST;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if we are converting to/from variants of XML or JSON
|
// Check if we are converting to/from variants of XML or JSON
|
||||||
let leaveContentTypeAlone = false;
|
let leaveContentTypeAlone = false;
|
||||||
if (contentTypeHeader && mimeType) {
|
if (contentTypeHeader && mimeType) {
|
||||||
|
Loading…
Reference in New Issue
Block a user