mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-21 23:43:15 +01:00
feat: request execution mode (#3200)
This commit is contained in:
parent
2dd5ae400c
commit
25f43f12c7
@ -55,6 +55,7 @@ if (!SERVER_RENDERED) {
|
|||||||
'req.setMaxRedirects(maxRedirects)',
|
'req.setMaxRedirects(maxRedirects)',
|
||||||
'req.getTimeout()',
|
'req.getTimeout()',
|
||||||
'req.setTimeout(timeout)',
|
'req.setTimeout(timeout)',
|
||||||
|
'req.getExecutionMode()',
|
||||||
'bru',
|
'bru',
|
||||||
'bru.cwd()',
|
'bru.cwd()',
|
||||||
'bru.getEnvName(key)',
|
'bru.getEnvName(key)',
|
||||||
|
@ -43,6 +43,8 @@ const runSingleRequest = async function (
|
|||||||
|
|
||||||
request = prepareRequest(bruJson.request, collectionRoot);
|
request = prepareRequest(bruJson.request, collectionRoot);
|
||||||
|
|
||||||
|
request.__bruno__executionMode = 'cli';
|
||||||
|
|
||||||
const scriptingConfig = get(brunoConfig, 'scripts', {});
|
const scriptingConfig = get(brunoConfig, 'scripts', {});
|
||||||
scriptingConfig.runtime = runtime;
|
scriptingConfig.runtime = runtime;
|
||||||
|
|
||||||
|
@ -525,6 +525,7 @@ const registerNetworkIpc = (mainWindow) => {
|
|||||||
|
|
||||||
const collectionRoot = get(collection, 'root', {});
|
const collectionRoot = get(collection, 'root', {});
|
||||||
const request = prepareRequest(item, collection);
|
const request = prepareRequest(item, collection);
|
||||||
|
request.__bruno__executionMode = 'standalone';
|
||||||
const envVars = getEnvVars(environment);
|
const envVars = getEnvVars(environment);
|
||||||
const processEnvVars = getProcessEnvVars(collectionUid);
|
const processEnvVars = getProcessEnvVars(collectionUid);
|
||||||
const brunoConfig = getBrunoConfig(collectionUid);
|
const brunoConfig = getBrunoConfig(collectionUid);
|
||||||
@ -717,6 +718,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, collectionRoot, collectionPath);
|
||||||
|
request.__bruno__executionMode = 'standalone';
|
||||||
const envVars = getEnvVars(environment);
|
const envVars = getEnvVars(environment);
|
||||||
const processEnvVars = getProcessEnvVars(collectionUid);
|
const processEnvVars = getProcessEnvVars(collectionUid);
|
||||||
const brunoConfig = getBrunoConfig(collectionUid);
|
const brunoConfig = getBrunoConfig(collectionUid);
|
||||||
@ -960,6 +962,8 @@ const registerNetworkIpc = (mainWindow) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const request = prepareRequest(item, collection);
|
const request = prepareRequest(item, collection);
|
||||||
|
request.__bruno__executionMode = 'runner';
|
||||||
|
|
||||||
const requestUid = uuid();
|
const requestUid = uuid();
|
||||||
const processEnvVars = getProcessEnvVars(collectionUid);
|
const processEnvVars = getProcessEnvVars(collectionUid);
|
||||||
|
|
||||||
|
@ -173,6 +173,10 @@ class BrunoRequest {
|
|||||||
disableParsingResponseJson() {
|
disableParsingResponseJson() {
|
||||||
this.req.__brunoDisableParsingResponseJson = true;
|
this.req.__brunoDisableParsingResponseJson = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getExecutionMode() {
|
||||||
|
return this.req.__bruno__executionMode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = BrunoRequest;
|
module.exports = BrunoRequest;
|
||||||
|
@ -111,6 +111,12 @@ const addBrunoRequestShimToContext = (vm, req) => {
|
|||||||
vm.setProp(reqObject, 'disableParsingResponseJson', disableParsingResponseJson);
|
vm.setProp(reqObject, 'disableParsingResponseJson', disableParsingResponseJson);
|
||||||
disableParsingResponseJson.dispose();
|
disableParsingResponseJson.dispose();
|
||||||
|
|
||||||
|
let getExecutionMode = vm.newFunction('getExecutionMode', function () {
|
||||||
|
return marshallToVm(req.getExecutionMode(), vm);
|
||||||
|
});
|
||||||
|
vm.setProp(reqObject, 'getExecutionMode', getExecutionMode);
|
||||||
|
getExecutionMode.dispose();
|
||||||
|
|
||||||
vm.setProp(vm.global, 'req', reqObject);
|
vm.setProp(vm.global, 'req', reqObject);
|
||||||
reqObject.dispose();
|
reqObject.dispose();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user