add functions to set response headers

This commit is contained in:
Marc Pfister 2024-11-21 11:54:33 -08:00
parent fb8c54dd7a
commit cb071dbd4f
2 changed files with 20 additions and 0 deletions

View File

@ -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',

View File

@ -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;