mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-07 16:44:27 +01:00
feat(#396): decomment support in json and scripts
This commit is contained in:
parent
d36956e0a4
commit
90f47e5877
36
package-lock.json
generated
36
package-lock.json
generated
@ -6678,6 +6678,18 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/decomment": {
|
||||||
|
"version": "0.9.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/decomment/-/decomment-0.9.5.tgz",
|
||||||
|
"integrity": "sha512-h0TZ8t6Dp49duwyDHo3iw67mnh9/UpFiSSiOb5gDK1sqoXzrfX/SQxIUQd2R2QEiSnqib0KF2fnKnGfAhAs6lg==",
|
||||||
|
"dependencies": {
|
||||||
|
"esprima": "4.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.4",
|
||||||
|
"npm": ">=2.15"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/decompress-response": {
|
"node_modules/decompress-response": {
|
||||||
"version": "3.3.0",
|
"version": "3.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz",
|
||||||
@ -7505,7 +7517,6 @@
|
|||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
||||||
"dev": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"esparse": "bin/esparse.js",
|
"esparse": "bin/esparse.js",
|
||||||
"esvalidate": "bin/esvalidate.js"
|
"esvalidate": "bin/esvalidate.js"
|
||||||
@ -16765,7 +16776,7 @@
|
|||||||
},
|
},
|
||||||
"packages/bruno-cli": {
|
"packages/bruno-cli": {
|
||||||
"name": "@usebruno/cli",
|
"name": "@usebruno/cli",
|
||||||
"version": "0.10.1",
|
"version": "0.11.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@usebruno/js": "0.6.0",
|
"@usebruno/js": "0.6.0",
|
||||||
@ -16773,6 +16784,7 @@
|
|||||||
"axios": "^1.5.1",
|
"axios": "^1.5.1",
|
||||||
"chai": "^4.3.7",
|
"chai": "^4.3.7",
|
||||||
"chalk": "^3.0.0",
|
"chalk": "^3.0.0",
|
||||||
|
"decomment": "^0.9.5",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"fs-extra": "^10.1.0",
|
"fs-extra": "^10.1.0",
|
||||||
"handlebars": "^4.7.8",
|
"handlebars": "^4.7.8",
|
||||||
@ -16810,7 +16822,7 @@
|
|||||||
},
|
},
|
||||||
"packages/bruno-electron": {
|
"packages/bruno-electron": {
|
||||||
"name": "bruno",
|
"name": "bruno",
|
||||||
"version": "v0.18.0",
|
"version": "v0.19.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@usebruno/js": "0.6.0",
|
"@usebruno/js": "0.6.0",
|
||||||
"@usebruno/lang": "0.5.0",
|
"@usebruno/lang": "0.5.0",
|
||||||
@ -16819,6 +16831,7 @@
|
|||||||
"axios": "^1.5.1",
|
"axios": "^1.5.1",
|
||||||
"chai": "^4.3.7",
|
"chai": "^4.3.7",
|
||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
|
"decomment": "^0.9.5",
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"electron-is-dev": "^2.0.0",
|
"electron-is-dev": "^2.0.0",
|
||||||
"electron-notarize": "^1.2.2",
|
"electron-notarize": "^1.2.2",
|
||||||
@ -16848,7 +16861,9 @@
|
|||||||
"dmg-license": "^1.0.11"
|
"dmg-license": "^1.0.11"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/bruno-electron/0.5cd ../.0": {},
|
"packages/bruno-electron/0.5cd ../.0": {
|
||||||
|
"extraneous": true
|
||||||
|
},
|
||||||
"packages/bruno-electron/node_modules/@types/node": {
|
"packages/bruno-electron/node_modules/@types/node": {
|
||||||
"version": "16.18.11",
|
"version": "16.18.11",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@ -20092,6 +20107,7 @@
|
|||||||
"axios": "^1.5.1",
|
"axios": "^1.5.1",
|
||||||
"chai": "^4.3.7",
|
"chai": "^4.3.7",
|
||||||
"chalk": "^3.0.0",
|
"chalk": "^3.0.0",
|
||||||
|
"decomment": "*",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"fs-extra": "^10.1.0",
|
"fs-extra": "^10.1.0",
|
||||||
"handlebars": "^4.7.8",
|
"handlebars": "^4.7.8",
|
||||||
@ -21201,6 +21217,7 @@
|
|||||||
"axios": "^1.5.1",
|
"axios": "^1.5.1",
|
||||||
"chai": "^4.3.7",
|
"chai": "^4.3.7",
|
||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
|
"decomment": "^0.9.5",
|
||||||
"dmg-license": "^1.0.11",
|
"dmg-license": "^1.0.11",
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"electron": "21.1.1",
|
"electron": "21.1.1",
|
||||||
@ -22309,6 +22326,14 @@
|
|||||||
"integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
|
"integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"decomment": {
|
||||||
|
"version": "0.9.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/decomment/-/decomment-0.9.5.tgz",
|
||||||
|
"integrity": "sha512-h0TZ8t6Dp49duwyDHo3iw67mnh9/UpFiSSiOb5gDK1sqoXzrfX/SQxIUQd2R2QEiSnqib0KF2fnKnGfAhAs6lg==",
|
||||||
|
"requires": {
|
||||||
|
"esprima": "4.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"decompress-response": {
|
"decompress-response": {
|
||||||
"version": "3.3.0",
|
"version": "3.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz",
|
||||||
@ -22958,8 +22983,7 @@
|
|||||||
"esprima": {
|
"esprima": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"esrecurse": {
|
"esrecurse": {
|
||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
"axios": "^1.5.1",
|
"axios": "^1.5.1",
|
||||||
"chai": "^4.3.7",
|
"chai": "^4.3.7",
|
||||||
"chalk": "^3.0.0",
|
"chalk": "^3.0.0",
|
||||||
|
"decomment": "^0.9.5",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"fs-extra": "^10.1.0",
|
"fs-extra": "^10.1.0",
|
||||||
"handlebars": "^4.7.8",
|
"handlebars": "^4.7.8",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const { get, each, filter } = require('lodash');
|
const { get, each, filter } = require('lodash');
|
||||||
|
const decomment = require('decomment');
|
||||||
|
|
||||||
const prepareRequest = (request) => {
|
const prepareRequest = (request) => {
|
||||||
const headers = {};
|
const headers = {};
|
||||||
@ -39,7 +40,7 @@ const prepareRequest = (request) => {
|
|||||||
axiosRequest.headers['content-type'] = 'application/json';
|
axiosRequest.headers['content-type'] = 'application/json';
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
axiosRequest.data = JSON.parse(request.body.json);
|
axiosRequest.data = JSON.parse(decomment(request.body.json));
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
axiosRequest.data = request.body.json;
|
axiosRequest.data = request.body.json;
|
||||||
}
|
}
|
||||||
@ -78,7 +79,7 @@ const prepareRequest = (request) => {
|
|||||||
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(get(request, 'body.graphql.variables') || '{}')
|
variables: JSON.parse(decomment(get(request, 'body.graphql.variables') || '{}'))
|
||||||
};
|
};
|
||||||
if (!contentTypeDefined) {
|
if (!contentTypeDefined) {
|
||||||
axiosRequest.headers['content-type'] = 'application/json';
|
axiosRequest.headers['content-type'] = 'application/json';
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const qs = require('qs');
|
const qs = require('qs');
|
||||||
const chalk = require('chalk');
|
const chalk = require('chalk');
|
||||||
|
const decomment = require('decomment');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const { forOwn, each, extend, get } = require('lodash');
|
const { forOwn, each, extend, get } = require('lodash');
|
||||||
const FormData = require('form-data');
|
const FormData = require('form-data');
|
||||||
@ -55,7 +56,7 @@ const runSingleRequest = async function (
|
|||||||
if (requestScriptFile && requestScriptFile.length) {
|
if (requestScriptFile && requestScriptFile.length) {
|
||||||
const scriptRuntime = new ScriptRuntime();
|
const scriptRuntime = new ScriptRuntime();
|
||||||
await scriptRuntime.runRequestScript(
|
await scriptRuntime.runRequestScript(
|
||||||
requestScriptFile,
|
decomment(requestScriptFile),
|
||||||
request,
|
request,
|
||||||
envVariables,
|
envVariables,
|
||||||
collectionVariables,
|
collectionVariables,
|
||||||
@ -180,7 +181,7 @@ const runSingleRequest = async function (
|
|||||||
if (responseScriptFile && responseScriptFile.length) {
|
if (responseScriptFile && responseScriptFile.length) {
|
||||||
const scriptRuntime = new ScriptRuntime();
|
const scriptRuntime = new ScriptRuntime();
|
||||||
await scriptRuntime.runResponseScript(
|
await scriptRuntime.runResponseScript(
|
||||||
responseScriptFile,
|
decomment(responseScriptFile),
|
||||||
request,
|
request,
|
||||||
response,
|
response,
|
||||||
envVariables,
|
envVariables,
|
||||||
@ -221,7 +222,7 @@ const runSingleRequest = async function (
|
|||||||
if (typeof testFile === 'string') {
|
if (typeof testFile === 'string') {
|
||||||
const testRuntime = new TestRuntime();
|
const testRuntime = new TestRuntime();
|
||||||
const result = await testRuntime.runTests(
|
const result = await testRuntime.runTests(
|
||||||
testFile,
|
decomment(testFile),
|
||||||
request,
|
request,
|
||||||
response,
|
response,
|
||||||
envVariables,
|
envVariables,
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
"axios": "^1.5.1",
|
"axios": "^1.5.1",
|
||||||
"chai": "^4.3.7",
|
"chai": "^4.3.7",
|
||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
|
"decomment": "^0.9.5",
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"electron-is-dev": "^2.0.0",
|
"electron-is-dev": "^2.0.0",
|
||||||
"electron-notarize": "^1.2.2",
|
"electron-notarize": "^1.2.2",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const qs = require('qs');
|
const qs = require('qs');
|
||||||
const https = require('https');
|
const https = require('https');
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
|
const decomment = require('decomment');
|
||||||
const Mustache = require('mustache');
|
const Mustache = require('mustache');
|
||||||
const FormData = require('form-data');
|
const FormData = require('form-data');
|
||||||
const { ipcMain } = require('electron');
|
const { ipcMain } = require('electron');
|
||||||
@ -151,7 +152,7 @@ const registerNetworkIpc = (mainWindow) => {
|
|||||||
if (requestScript && requestScript.length) {
|
if (requestScript && requestScript.length) {
|
||||||
const scriptRuntime = new ScriptRuntime();
|
const scriptRuntime = new ScriptRuntime();
|
||||||
const result = await scriptRuntime.runRequestScript(
|
const result = await scriptRuntime.runRequestScript(
|
||||||
requestScript,
|
decomment(requestScript),
|
||||||
request,
|
request,
|
||||||
envVars,
|
envVars,
|
||||||
collectionVariables,
|
collectionVariables,
|
||||||
@ -277,7 +278,7 @@ const registerNetworkIpc = (mainWindow) => {
|
|||||||
if (responseScript && responseScript.length) {
|
if (responseScript && responseScript.length) {
|
||||||
const scriptRuntime = new ScriptRuntime();
|
const scriptRuntime = new ScriptRuntime();
|
||||||
const result = await scriptRuntime.runResponseScript(
|
const result = await scriptRuntime.runResponseScript(
|
||||||
responseScript,
|
decomment(responseScript),
|
||||||
request,
|
request,
|
||||||
response,
|
response,
|
||||||
envVars,
|
envVars,
|
||||||
@ -323,7 +324,7 @@ const registerNetworkIpc = (mainWindow) => {
|
|||||||
if (typeof testFile === 'string') {
|
if (typeof testFile === 'string') {
|
||||||
const testRuntime = new TestRuntime();
|
const testRuntime = new TestRuntime();
|
||||||
const testResults = await testRuntime.runTests(
|
const testResults = await testRuntime.runTests(
|
||||||
testFile,
|
decomment(testFile),
|
||||||
request,
|
request,
|
||||||
response,
|
response,
|
||||||
envVars,
|
envVars,
|
||||||
@ -402,7 +403,7 @@ const registerNetworkIpc = (mainWindow) => {
|
|||||||
if (typeof testFile === 'string') {
|
if (typeof testFile === 'string') {
|
||||||
const testRuntime = new TestRuntime();
|
const testRuntime = new TestRuntime();
|
||||||
const testResults = await testRuntime.runTests(
|
const testResults = await testRuntime.runTests(
|
||||||
testFile,
|
decomment(testFile),
|
||||||
request,
|
request,
|
||||||
error.response,
|
error.response,
|
||||||
envVars,
|
envVars,
|
||||||
@ -603,7 +604,7 @@ const registerNetworkIpc = (mainWindow) => {
|
|||||||
if (requestScript && requestScript.length) {
|
if (requestScript && requestScript.length) {
|
||||||
const scriptRuntime = new ScriptRuntime();
|
const scriptRuntime = new ScriptRuntime();
|
||||||
const result = await scriptRuntime.runRequestScript(
|
const result = await scriptRuntime.runRequestScript(
|
||||||
requestScript,
|
decomment(requestScript),
|
||||||
request,
|
request,
|
||||||
envVars,
|
envVars,
|
||||||
collectionVariables,
|
collectionVariables,
|
||||||
@ -704,7 +705,7 @@ const registerNetworkIpc = (mainWindow) => {
|
|||||||
if (responseScript && responseScript.length) {
|
if (responseScript && responseScript.length) {
|
||||||
const scriptRuntime = new ScriptRuntime();
|
const scriptRuntime = new ScriptRuntime();
|
||||||
const result = await scriptRuntime.runResponseScript(
|
const result = await scriptRuntime.runResponseScript(
|
||||||
responseScript,
|
decomment(responseScript),
|
||||||
request,
|
request,
|
||||||
response,
|
response,
|
||||||
envVars,
|
envVars,
|
||||||
@ -748,7 +749,7 @@ const registerNetworkIpc = (mainWindow) => {
|
|||||||
if (typeof testFile === 'string') {
|
if (typeof testFile === 'string') {
|
||||||
const testRuntime = new TestRuntime();
|
const testRuntime = new TestRuntime();
|
||||||
const testResults = await testRuntime.runTests(
|
const testResults = await testRuntime.runTests(
|
||||||
testFile,
|
decomment(testFile),
|
||||||
request,
|
request,
|
||||||
response,
|
response,
|
||||||
envVars,
|
envVars,
|
||||||
@ -828,7 +829,7 @@ const registerNetworkIpc = (mainWindow) => {
|
|||||||
if (typeof testFile === 'string') {
|
if (typeof testFile === 'string') {
|
||||||
const testRuntime = new TestRuntime();
|
const testRuntime = new TestRuntime();
|
||||||
const testResults = await testRuntime.runTests(
|
const testResults = await testRuntime.runTests(
|
||||||
testFile,
|
decomment(testFile),
|
||||||
request,
|
request,
|
||||||
error.response,
|
error.response,
|
||||||
envVars,
|
envVars,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const { get, each, filter } = require('lodash');
|
const { get, each, filter } = require('lodash');
|
||||||
|
const decomment = require('decomment');
|
||||||
|
|
||||||
const prepareRequest = (request) => {
|
const prepareRequest = (request) => {
|
||||||
const headers = {};
|
const headers = {};
|
||||||
@ -37,7 +38,8 @@ const prepareRequest = (request) => {
|
|||||||
axiosRequest.headers['content-type'] = 'application/json';
|
axiosRequest.headers['content-type'] = 'application/json';
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
axiosRequest.data = JSON.parse(request.body.json);
|
// axiosRequest.data = JSON.parse(request.body.json);
|
||||||
|
axiosRequest.data = JSON.parse(decomment(request.body.json));
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
axiosRequest.data = request.body.json;
|
axiosRequest.data = request.body.json;
|
||||||
}
|
}
|
||||||
@ -76,7 +78,7 @@ const prepareRequest = (request) => {
|
|||||||
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(get(request, 'body.graphql.variables') || '{}')
|
variables: JSON.parse(decomment(get(request, 'body.graphql.variables') || '{}'))
|
||||||
};
|
};
|
||||||
if (!contentTypeDefined) {
|
if (!contentTypeDefined) {
|
||||||
axiosRequest.headers['content-type'] = 'application/json';
|
axiosRequest.headers['content-type'] = 'application/json';
|
||||||
|
Loading…
Reference in New Issue
Block a user