mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-29 15:44:13 +00:00
fetch/refresh token - collection/request variables usage fix
This commit is contained in:
@@ -1324,7 +1324,7 @@ export const refreshOauth2Credentials = (payload) => async (dispatch, getState)
|
||||
request.globalEnvironmentVariables = globalEnvironmentVariables;
|
||||
return new Promise((resolve, reject) => {
|
||||
window.ipcRenderer
|
||||
.invoke('renderer:refresh-oauth2-credentials', { request, collection })
|
||||
.invoke('renderer:refresh-oauth2-credentials', { itemUid, request, collection })
|
||||
.then(({ credentials, url, collectionUid, debugInfo, credentialsId }) => {
|
||||
dispatch(
|
||||
collectionAddOauth2CredentialsByUrl({
|
||||
|
||||
@@ -985,9 +985,7 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
|
||||
const processEnvVars = getProcessEnvVars(collectionUid);
|
||||
const partialItem = { uid: itemUid };
|
||||
const requestTreePath = getTreePathFromCollectionToItem(collection, partialItem);
|
||||
if (requestTreePath && requestTreePath.length > 0) {
|
||||
mergeVars(collection, requestCopy, requestTreePath);
|
||||
}
|
||||
mergeVars(collection, requestCopy, requestTreePath);
|
||||
|
||||
interpolateVars(requestCopy, envVars, runtimeVariables, processEnvVars);
|
||||
const certsAndProxyConfig = await getCertsAndProxyConfig({
|
||||
@@ -1108,7 +1106,7 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('renderer:refresh-oauth2-credentials', async (event, { request, collection }) => {
|
||||
ipcMain.handle('renderer:refresh-oauth2-credentials', async (event, { itemUid, request, collection }) => {
|
||||
try {
|
||||
if (request.oauth2) {
|
||||
let requestCopy = _.cloneDeep(request);
|
||||
@@ -1116,7 +1114,11 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
|
||||
const environment = _.find(environments, (e) => e.uid === activeEnvironmentUid);
|
||||
const envVars = getEnvVars(environment);
|
||||
const processEnvVars = getProcessEnvVars(collectionUid);
|
||||
const partialItem = { uid: itemUid };
|
||||
const requestTreePath = getTreePathFromCollectionToItem(collection, partialItem);
|
||||
mergeVars(collection, requestCopy, requestTreePath);
|
||||
interpolateVars(requestCopy, envVars, runtimeVariables, processEnvVars);
|
||||
|
||||
const certsAndProxyConfig = await getCertsAndProxyConfig({
|
||||
collectionUid,
|
||||
request: requestCopy,
|
||||
|
||||
@@ -47,7 +47,7 @@ const mergeHeaders = (collection, request, requestTreePath) => {
|
||||
request.headers = Array.from(headers, ([name, value]) => ({ name, value, enabled: true }));
|
||||
};
|
||||
|
||||
const mergeVars = (collection, request, requestTreePath) => {
|
||||
const mergeVars = (collection, request, requestTreePath = []) => {
|
||||
let reqVars = new Map();
|
||||
let collectionRequestVars = get(collection, 'root.request.vars.req', []);
|
||||
let collectionVariables = {};
|
||||
|
||||
Reference in New Issue
Block a user