mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-07 08:34: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.getTimeout()',
|
||||
'req.setTimeout(timeout)',
|
||||
'req.getExecutionMode()',
|
||||
'bru',
|
||||
'bru.cwd()',
|
||||
'bru.getEnvName(key)',
|
||||
|
@ -43,6 +43,8 @@ const runSingleRequest = async function (
|
||||
|
||||
request = prepareRequest(bruJson.request, collectionRoot);
|
||||
|
||||
request.__bruno__executionMode = 'cli';
|
||||
|
||||
const scriptingConfig = get(brunoConfig, 'scripts', {});
|
||||
scriptingConfig.runtime = runtime;
|
||||
|
||||
|
@ -525,6 +525,7 @@ const registerNetworkIpc = (mainWindow) => {
|
||||
|
||||
const collectionRoot = get(collection, 'root', {});
|
||||
const request = prepareRequest(item, collection);
|
||||
request.__bruno__executionMode = 'standalone';
|
||||
const envVars = getEnvVars(environment);
|
||||
const processEnvVars = getProcessEnvVars(collectionUid);
|
||||
const brunoConfig = getBrunoConfig(collectionUid);
|
||||
@ -717,6 +718,7 @@ const registerNetworkIpc = (mainWindow) => {
|
||||
const collectionRoot = get(collection, 'root', {});
|
||||
const _request = collectionRoot?.request;
|
||||
const request = prepareCollectionRequest(_request, collectionRoot, collectionPath);
|
||||
request.__bruno__executionMode = 'standalone';
|
||||
const envVars = getEnvVars(environment);
|
||||
const processEnvVars = getProcessEnvVars(collectionUid);
|
||||
const brunoConfig = getBrunoConfig(collectionUid);
|
||||
@ -960,6 +962,8 @@ const registerNetworkIpc = (mainWindow) => {
|
||||
});
|
||||
|
||||
const request = prepareRequest(item, collection);
|
||||
request.__bruno__executionMode = 'runner';
|
||||
|
||||
const requestUid = uuid();
|
||||
const processEnvVars = getProcessEnvVars(collectionUid);
|
||||
|
||||
|
@ -173,6 +173,10 @@ class BrunoRequest {
|
||||
disableParsingResponseJson() {
|
||||
this.req.__brunoDisableParsingResponseJson = true;
|
||||
}
|
||||
|
||||
getExecutionMode() {
|
||||
return this.req.__bruno__executionMode;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = BrunoRequest;
|
||||
|
@ -111,6 +111,12 @@ const addBrunoRequestShimToContext = (vm, req) => {
|
||||
vm.setProp(reqObject, 'disableParsingResponseJson', disableParsingResponseJson);
|
||||
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);
|
||||
reqObject.dispose();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user