mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-07 14:08:38 +00:00
feat/rename collectionVariables variable name to runtimeVariables (#2638)
* pr review changes * collection root object in export json * import environment updates * tests run execution order fix for collection runs * updated validations * collectionVariables -> runtimeVariables * removed husky, adjusted indentation --------- Co-authored-by: Anoop M D <anoop.md1421@gmail.com>
This commit is contained in:
@@ -798,7 +798,7 @@ export const getAllVariables = (collection, item) => {
|
||||
return {
|
||||
...environmentVariables,
|
||||
...requestVariables,
|
||||
...collection.collectionVariables,
|
||||
...collection.runtimeVariables,
|
||||
pathParams: {
|
||||
...pathParams
|
||||
},
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { safeStringifyJSON } from 'utils/common';
|
||||
|
||||
export const sendNetworkRequest = async (item, collection, environment, collectionVariables) => {
|
||||
export const sendNetworkRequest = async (item, collection, environment, runtimeVariables) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (['http-request', 'graphql-request'].includes(item.type)) {
|
||||
sendHttpRequest(item, collection, environment, collectionVariables)
|
||||
sendHttpRequest(item, collection, environment, runtimeVariables)
|
||||
.then((response) => {
|
||||
resolve({
|
||||
state: 'success',
|
||||
@@ -22,22 +22,22 @@ export const sendNetworkRequest = async (item, collection, environment, collecti
|
||||
});
|
||||
};
|
||||
|
||||
const sendHttpRequest = async (item, collection, environment, collectionVariables) => {
|
||||
const sendHttpRequest = async (item, collection, environment, runtimeVariables) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const { ipcRenderer } = window;
|
||||
|
||||
ipcRenderer
|
||||
.invoke('send-http-request', item, collection, environment, collectionVariables)
|
||||
.invoke('send-http-request', item, collection, environment, runtimeVariables)
|
||||
.then(resolve)
|
||||
.catch(reject);
|
||||
});
|
||||
};
|
||||
|
||||
export const sendCollectionOauth2Request = async (collection, environment, collectionVariables) => {
|
||||
export const sendCollectionOauth2Request = async (collection, environment, runtimeVariables) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const { ipcRenderer } = window;
|
||||
ipcRenderer
|
||||
.invoke('send-collection-oauth2-request', collection, environment, collectionVariables)
|
||||
.invoke('send-collection-oauth2-request', collection, environment, runtimeVariables)
|
||||
.then(resolve)
|
||||
.catch(reject);
|
||||
});
|
||||
|
||||
@@ -107,14 +107,14 @@ export const isValidUrl = (url) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const interpolateUrl = ({ url, envVars, collectionVariables, processEnvVars }) => {
|
||||
export const interpolateUrl = ({ url, envVars, runtimeVariables, processEnvVars }) => {
|
||||
if (!url || !url.length || typeof url !== 'string') {
|
||||
return;
|
||||
}
|
||||
|
||||
return interpolate(url, {
|
||||
...envVars,
|
||||
...collectionVariables,
|
||||
...runtimeVariables,
|
||||
process: {
|
||||
env: {
|
||||
...processEnvVars
|
||||
|
||||
@@ -129,10 +129,10 @@ describe('Url Utils - interpolateUrl, interpolateUrlPathParams', () => {
|
||||
const expectedUrl = 'https://example.com/api/:id/path?foo=foo_value&bar=bar_value&baz=baz_value';
|
||||
|
||||
const envVars = { host: 'https://example.com', foo: 'foo_value' };
|
||||
const collectionVariables = { bar: 'bar_value' };
|
||||
const runtimeVariables = { bar: 'bar_value' };
|
||||
const processEnvVars = { baz: 'baz_value' };
|
||||
|
||||
const result = interpolateUrl({ url, envVars, collectionVariables, processEnvVars });
|
||||
const result = interpolateUrl({ url, envVars, runtimeVariables, processEnvVars });
|
||||
|
||||
expect(result).toEqual(expectedUrl);
|
||||
});
|
||||
@@ -153,10 +153,10 @@ describe('Url Utils - interpolateUrl, interpolateUrlPathParams', () => {
|
||||
const expectedUrl = 'https://example.com/api/123/path?foo=foo_value&bar=bar_value&baz=baz_value';
|
||||
|
||||
const envVars = { host: 'https://example.com', foo: 'foo_value' };
|
||||
const collectionVariables = { bar: 'bar_value' };
|
||||
const runtimeVariables = { bar: 'bar_value' };
|
||||
const processEnvVars = { baz: 'baz_value' };
|
||||
|
||||
const intermediateResult = interpolateUrl({ url, envVars, collectionVariables, processEnvVars });
|
||||
const intermediateResult = interpolateUrl({ url, envVars, runtimeVariables, processEnvVars });
|
||||
const result = interpolateUrlPathParams(intermediateResult, params);
|
||||
|
||||
expect(result).toEqual(expectedUrl);
|
||||
|
||||
Reference in New Issue
Block a user