mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-15 20:01:28 +00:00
Fix: res.setBody fails for Object in Developer-mode
vm2 returns a recursive Proxy for accessing the return value which cannot be serialized for IPC using `structuredClone`. Co-authored-by: ramki-bruno <ramki@usebruno.com>
This commit is contained in:
@@ -35,6 +35,7 @@ if (!SERVER_RENDERED) {
|
||||
'res.getHeader(name)',
|
||||
'res.getHeaders()',
|
||||
'res.getBody()',
|
||||
'res.setBody(data)',
|
||||
'res.getResponseTime()',
|
||||
'req',
|
||||
'req.url',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const { get } = require('@usebruno/query');
|
||||
const _ = require('lodash');
|
||||
|
||||
class BrunoResponse {
|
||||
constructor(res) {
|
||||
@@ -46,8 +47,9 @@ class BrunoResponse {
|
||||
return;
|
||||
}
|
||||
|
||||
this.body = data;
|
||||
this.res.data = data;
|
||||
const clonedData = _.cloneDeep(data);
|
||||
this.res.data = clonedData;
|
||||
this.body = clonedData;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user