mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-07 14:08:38 +00:00
Merge branch 'main' into feat/url-encoding-settings-refactor
This commit is contained in:
@@ -138,6 +138,7 @@ const bruToJson = (data, parsed = false) => {
|
||||
name: _.get(json, 'meta.name'),
|
||||
seq: !_.isNaN(sequence) ? Number(sequence) : 1,
|
||||
settings: _.get(json, 'settings', {}),
|
||||
tags: _.get(json, 'meta.tags', []),
|
||||
request: {
|
||||
method: _.upperCase(_.get(json, 'http.method')),
|
||||
url: _.get(json, 'http.url'),
|
||||
@@ -155,7 +156,6 @@ const bruToJson = (data, parsed = false) => {
|
||||
|
||||
transformedJson.request.auth.mode = _.get(json, 'http.auth', 'none');
|
||||
transformedJson.request.body.mode = _.get(json, 'http.body', 'none');
|
||||
|
||||
return transformedJson;
|
||||
} catch (e) {
|
||||
return Promise.reject(e);
|
||||
@@ -195,7 +195,8 @@ const jsonToBru = async (json) => {
|
||||
meta: {
|
||||
name: _.get(json, 'name'),
|
||||
type: type,
|
||||
seq: !_.isNaN(sequence) ? Number(sequence) : 1
|
||||
seq: !_.isNaN(sequence) ? Number(sequence) : 1,
|
||||
tags: _.get(json, 'tags', []),
|
||||
},
|
||||
http: {
|
||||
method: _.lowerCase(_.get(json, 'request.method')),
|
||||
@@ -237,7 +238,8 @@ const jsonToBruViaWorker = async (json) => {
|
||||
meta: {
|
||||
name: _.get(json, 'name'),
|
||||
type: type,
|
||||
seq: !_.isNaN(sequence) ? Number(sequence) : 1
|
||||
seq: !_.isNaN(sequence) ? Number(sequence) : 1,
|
||||
tags: _.get(json, 'tags', [])
|
||||
},
|
||||
http: {
|
||||
method: _.lowerCase(_.get(json, 'request.method')),
|
||||
|
||||
@@ -31,6 +31,7 @@ const { preferencesUtil } = require('../../store/preferences');
|
||||
const { getProcessEnvVars } = require('../../store/process-env');
|
||||
const { getBrunoConfig } = require('../../store/bruno-config');
|
||||
const Oauth2Store = require('../../store/oauth2');
|
||||
const { isRequestTagsIncluded } = require('@usebruno/common');
|
||||
|
||||
const saveCookies = (url, headers) => {
|
||||
if (preferencesUtil.shouldStoreCookies()) {
|
||||
@@ -952,7 +953,7 @@ const registerNetworkIpc = (mainWindow) => {
|
||||
|
||||
ipcMain.handle(
|
||||
'renderer:run-collection-folder',
|
||||
async (event, folder, collection, environment, runtimeVariables, recursive, delay) => {
|
||||
async (event, folder, collection, environment, runtimeVariables, recursive, delay, tags) => {
|
||||
const collectionUid = collection.uid;
|
||||
const collectionPath = collection.pathname;
|
||||
const folderUid = folder ? folder.uid : null;
|
||||
@@ -1012,6 +1013,15 @@ const registerNetworkIpc = (mainWindow) => {
|
||||
folderRequests = sortByNameThenSequence(folderRequests)
|
||||
}
|
||||
|
||||
// Filter requests based on tags
|
||||
if (tags && tags.include && tags.exclude) {
|
||||
const includeTags = tags.include ? tags.include : [];
|
||||
const excludeTags = tags.exclude ? tags.exclude : [];
|
||||
folderRequests = folderRequests.filter(({ tags }) => {
|
||||
return isRequestTagsIncluded(tags, includeTags, excludeTags)
|
||||
});
|
||||
}
|
||||
|
||||
let currentRequestIndex = 0;
|
||||
let nJumps = 0; // count the number of jumps to avoid infinite loops
|
||||
while (currentRequestIndex < folderRequests.length) {
|
||||
|
||||
@@ -61,6 +61,7 @@ const setAuthHeaders = (axiosRequest, request, collectionRoot) => {
|
||||
break;
|
||||
case 'apikey':
|
||||
const apiKeyAuth = get(collectionAuth, 'apikey');
|
||||
if (apiKeyAuth.key.length === 0) break;
|
||||
if (apiKeyAuth.placement === 'header') {
|
||||
axiosRequest.headers[apiKeyAuth.key] = apiKeyAuth.value;
|
||||
} else if (apiKeyAuth.placement === 'queryparams') {
|
||||
@@ -277,6 +278,7 @@ const setAuthHeaders = (axiosRequest, request, collectionRoot) => {
|
||||
break;
|
||||
case 'apikey':
|
||||
const apiKeyAuth = get(request, 'auth.apikey');
|
||||
if (apiKeyAuth.key.length === 0) break;
|
||||
if (apiKeyAuth.placement === 'header') {
|
||||
axiosRequest.headers[apiKeyAuth.key] = apiKeyAuth.value;
|
||||
} else if (apiKeyAuth.placement === 'queryparams') {
|
||||
@@ -426,7 +428,7 @@ const prepareRequest = async (item, collection = {}, abortController) => {
|
||||
}
|
||||
|
||||
// if the mode is 'none' then set the content-type header to false. #1693
|
||||
if (request.body.mode === 'none') {
|
||||
if (request.body.mode === 'none' && request.auth.mode !== 'awsv4') {
|
||||
if(!contentTypeDefined) {
|
||||
axiosRequest.headers['content-type'] = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user