diff --git a/packages/bruno-app/src/components/CodeEditor/index.js b/packages/bruno-app/src/components/CodeEditor/index.js index aa0238ef0..164762926 100644 --- a/packages/bruno-app/src/components/CodeEditor/index.js +++ b/packages/bruno-app/src/components/CodeEditor/index.js @@ -34,6 +34,9 @@ if (!SERVER_RENDERED) { 'res.getHeader(name)', 'res.getHeaders()', 'res.getBody()', + 'res.setHeader(name, value)', + 'res.setHeaders(data)', + 'res.setBody(data)', 'res.getResponseTime()', 'req', 'req.url', diff --git a/packages/bruno-js/src/bruno-response.js b/packages/bruno-js/src/bruno-response.js index 9e68045d9..a65c3e912 100644 --- a/packages/bruno-js/src/bruno-response.js +++ b/packages/bruno-js/src/bruno-response.js @@ -36,6 +36,23 @@ class BrunoResponse { this.body = data; this.res.data = data; } + + setHeader(name, value) { + if (!this.res) { + return; + } + this.headers[name] = value; + this.res.headers[name] = value; + } + + setHeaders(headers) { + if (!this.res) { + return; + } + this.headers = headers; + this.res.headers = headers; + } + } module.exports = BrunoResponse;