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.setTimeout(timeout)',
|
||||
'req.getExecutionMode()',
|
||||
'req.getPathName()',
|
||||
'bru',
|
||||
'bru.cwd()',
|
||||
'bru.getEnvName(key)',
|
||||
|
@ -44,6 +44,7 @@ const runSingleRequest = async function (
|
||||
request = prepareRequest(bruJson.request, collectionRoot);
|
||||
|
||||
request.__bruno__executionMode = 'cli';
|
||||
request.__pathname = path.join(collectionPath,filename);
|
||||
|
||||
const scriptingConfig = get(brunoConfig, 'scripts', {});
|
||||
scriptingConfig.runtime = runtime;
|
||||
|
@ -538,6 +538,7 @@ const registerNetworkIpc = (mainWindow) => {
|
||||
const collectionRoot = get(collection, 'root', {});
|
||||
const request = prepareRequest(item, collection);
|
||||
request.__bruno__executionMode = 'standalone';
|
||||
request.__pathname = item.pathname;
|
||||
const envVars = getEnvVars(environment);
|
||||
const processEnvVars = getProcessEnvVars(collectionUid);
|
||||
const brunoConfig = getBrunoConfig(collectionUid);
|
||||
@ -979,6 +980,7 @@ const registerNetworkIpc = (mainWindow) => {
|
||||
|
||||
const request = prepareRequest(item, collection);
|
||||
request.__bruno__executionMode = 'runner';
|
||||
request.__pathname = item.pathname;
|
||||
|
||||
const requestUid = uuid();
|
||||
const processEnvVars = getProcessEnvVars(collectionUid);
|
||||
|
@ -177,6 +177,11 @@ class BrunoRequest {
|
||||
getExecutionMode() {
|
||||
return this.req.__bruno__executionMode;
|
||||
}
|
||||
|
||||
getPathName() {
|
||||
return this.req.__pathname;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = BrunoRequest;
|
||||
|
@ -117,6 +117,12 @@ const addBrunoRequestShimToContext = (vm, req) => {
|
||||
vm.setProp(reqObject, 'getExecutionMode', getExecutionMode);
|
||||
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);
|
||||
reqObject.dispose();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user