mirror of
https://github.com/usebruno/bruno.git
synced 2025-06-24 05:51:22 +02:00
Merge pull request #887 from Andreas-Schoenefeldt/bugfix/bug-884
#884: Made sure graphql variables are only parsed after interpolation
This commit is contained in:
commit
b7e84f3623
@ -275,6 +275,12 @@ const registerNetworkIpc = (mainWindow) => {
|
|||||||
// interpolate variables inside request
|
// interpolate variables inside request
|
||||||
interpolateVars(request, envVars, collectionVariables, processEnvVars);
|
interpolateVars(request, envVars, collectionVariables, processEnvVars);
|
||||||
|
|
||||||
|
// if this is a graphql request, parse the variables, only after interpolation
|
||||||
|
// https://github.com/usebruno/bruno/issues/884
|
||||||
|
if (request.mode === 'graphql') {
|
||||||
|
request.data.variables = JSON.parse(request.data.variables);
|
||||||
|
}
|
||||||
|
|
||||||
// stringify the request url encoded params
|
// stringify the request url encoded params
|
||||||
if (request.headers['content-type'] === 'application/x-www-form-urlencoded') {
|
if (request.headers['content-type'] === 'application/x-www-form-urlencoded') {
|
||||||
request.data = qs.stringify(request.data);
|
request.data = qs.stringify(request.data);
|
||||||
|
@ -101,6 +101,7 @@ const prepareRequest = (request, collectionRoot) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let axiosRequest = {
|
let axiosRequest = {
|
||||||
|
mode: request.body.mode,
|
||||||
method: request.method,
|
method: request.method,
|
||||||
url,
|
url,
|
||||||
headers,
|
headers,
|
||||||
@ -170,7 +171,8 @@ const prepareRequest = (request, collectionRoot) => {
|
|||||||
if (request.body.mode === 'graphql') {
|
if (request.body.mode === 'graphql') {
|
||||||
const graphqlQuery = {
|
const graphqlQuery = {
|
||||||
query: get(request, 'body.graphql.query'),
|
query: get(request, 'body.graphql.query'),
|
||||||
variables: JSON.parse(decomment(get(request, 'body.graphql.variables') || '{}'))
|
// https://github.com/usebruno/bruno/issues/884 - we must only parse the variables after the variable interpolation
|
||||||
|
variables: decomment(get(request, 'body.graphql.variables') || '{}')
|
||||||
};
|
};
|
||||||
if (!contentTypeDefined) {
|
if (!contentTypeDefined) {
|
||||||
axiosRequest.headers['content-type'] = 'application/json';
|
axiosRequest.headers['content-type'] = 'application/json';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user