fix(#3287): res.setbody safe mode (#3299)

This commit is contained in:
lohit 2024-10-14 12:27:12 +05:30 committed by GitHub
parent 40fad99803
commit 3ef7df57e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,6 +48,12 @@ const addBrunoResponseShimToContext = (vm, res) => {
vm.setProp(resObject, 'getResponseTime', getResponseTime);
getResponseTime.dispose();
let setBody = vm.newFunction('setBody', function (data) {
res.setBody(vm.dump(data));
});
vm.setProp(resObject, 'setBody', setBody);
setBody.dispose();
vm.setProp(vm.global, 'res', resObject);
resObject.dispose();
};