Merge pull request #3392 from lohxt1/fix/oauth2-global-env-values

fix: include global env varaibles for oauth2
This commit is contained in:
lohit 2024-10-30 18:02:54 +05:30 committed by GitHub
commit a580f88f63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 3 deletions

View File

@ -201,7 +201,7 @@ export const sendCollectionOauth2Request = (collectionUid, itemUid) => (dispatch
const environment = findEnvironmentInCollection(collectionCopy, collection.activeEnvironmentUid); const environment = findEnvironmentInCollection(collectionCopy, collection.activeEnvironmentUid);
_sendCollectionOauth2Request(collection, environment, collectionCopy.runtimeVariables) _sendCollectionOauth2Request(collectionCopy, environment, collectionCopy.runtimeVariables)
.then((response) => { .then((response) => {
if (response?.data?.error) { if (response?.data?.error) {
toast.error(response?.data?.error); toast.error(response?.data?.error);

View File

@ -741,7 +741,7 @@ const registerNetworkIpc = (mainWindow) => {
const collectionRoot = get(collection, 'root', {}); const collectionRoot = get(collection, 'root', {});
const _request = collectionRoot?.request; const _request = collectionRoot?.request;
const request = prepareCollectionRequest(_request, collectionRoot, collectionPath); const request = prepareCollectionRequest(_request, collection, collectionPath);
request.__bruno__executionMode = 'standalone'; request.__bruno__executionMode = 'standalone';
const envVars = getEnvVars(environment); const envVars = getEnvVars(environment);
const processEnvVars = getProcessEnvVars(collectionUid); const processEnvVars = getProcessEnvVars(collectionUid);

View File

@ -1,7 +1,8 @@
const { get, each } = require('lodash'); const { get, each } = require('lodash');
const { setAuthHeaders } = require('./prepare-request'); const { setAuthHeaders } = require('./prepare-request');
const prepareCollectionRequest = (request, collectionRoot) => { const prepareCollectionRequest = (request, collection) => {
const collectionRoot = get(collection, 'root', {});
const headers = {}; const headers = {};
let contentTypeDefined = false; let contentTypeDefined = false;
let url = request.url; let url = request.url;
@ -35,6 +36,8 @@ const prepareCollectionRequest = (request, collectionRoot) => {
axiosRequest = setAuthHeaders(axiosRequest, request, collectionRoot); axiosRequest = setAuthHeaders(axiosRequest, request, collectionRoot);
axiosRequest.globalEnvironmentVariables = collection?.globalEnvironmentVariables;
if (request.script) { if (request.script) {
axiosRequest.script = request.script; axiosRequest.script = request.script;
} }