mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-24 08:53:30 +01:00
implement req.getPathName()
This commit is contained in:
parent
2fc79e0e7f
commit
b7e8c9d87f
@ -56,6 +56,7 @@ if (!SERVER_RENDERED) {
|
|||||||
'req.getTimeout()',
|
'req.getTimeout()',
|
||||||
'req.setTimeout(timeout)',
|
'req.setTimeout(timeout)',
|
||||||
'req.getExecutionMode()',
|
'req.getExecutionMode()',
|
||||||
|
'req.getPathName()',
|
||||||
'bru',
|
'bru',
|
||||||
'bru.cwd()',
|
'bru.cwd()',
|
||||||
'bru.getEnvName(key)',
|
'bru.getEnvName(key)',
|
||||||
|
@ -44,6 +44,7 @@ const runSingleRequest = async function (
|
|||||||
request = prepareRequest(bruJson.request, collectionRoot);
|
request = prepareRequest(bruJson.request, collectionRoot);
|
||||||
|
|
||||||
request.__bruno__executionMode = 'cli';
|
request.__bruno__executionMode = 'cli';
|
||||||
|
request.__pathname = path.join(collectionPath,filename);
|
||||||
|
|
||||||
const scriptingConfig = get(brunoConfig, 'scripts', {});
|
const scriptingConfig = get(brunoConfig, 'scripts', {});
|
||||||
scriptingConfig.runtime = runtime;
|
scriptingConfig.runtime = runtime;
|
||||||
|
@ -538,6 +538,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';
|
request.__bruno__executionMode = 'standalone';
|
||||||
|
request.__pathname = item.pathname;
|
||||||
const envVars = getEnvVars(environment);
|
const envVars = getEnvVars(environment);
|
||||||
const processEnvVars = getProcessEnvVars(collectionUid);
|
const processEnvVars = getProcessEnvVars(collectionUid);
|
||||||
const brunoConfig = getBrunoConfig(collectionUid);
|
const brunoConfig = getBrunoConfig(collectionUid);
|
||||||
@ -979,6 +980,7 @@ const registerNetworkIpc = (mainWindow) => {
|
|||||||
|
|
||||||
const request = prepareRequest(item, collection);
|
const request = prepareRequest(item, collection);
|
||||||
request.__bruno__executionMode = 'runner';
|
request.__bruno__executionMode = 'runner';
|
||||||
|
request.__pathname = item.pathname;
|
||||||
|
|
||||||
const requestUid = uuid();
|
const requestUid = uuid();
|
||||||
const processEnvVars = getProcessEnvVars(collectionUid);
|
const processEnvVars = getProcessEnvVars(collectionUid);
|
||||||
|
@ -177,6 +177,11 @@ class BrunoRequest {
|
|||||||
getExecutionMode() {
|
getExecutionMode() {
|
||||||
return this.req.__bruno__executionMode;
|
return this.req.__bruno__executionMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPathName() {
|
||||||
|
return this.req.__pathname;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = BrunoRequest;
|
module.exports = BrunoRequest;
|
||||||
|
@ -117,6 +117,12 @@ const addBrunoRequestShimToContext = (vm, req) => {
|
|||||||
vm.setProp(reqObject, 'getExecutionMode', getExecutionMode);
|
vm.setProp(reqObject, 'getExecutionMode', getExecutionMode);
|
||||||
getExecutionMode.dispose();
|
getExecutionMode.dispose();
|
||||||
|
|
||||||
|
let getPathName = vm.newFunction('getPathName', function () {
|
||||||
|
return marshallToVm(req.getPathName(), vm);
|
||||||
|
});
|
||||||
|
vm.setProp(reqObject, 'getPathName', getPathName);
|
||||||
|
getPathName.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