mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-22 06:31:18 +01:00
add functions to set response headers
This commit is contained in:
parent
fb8c54dd7a
commit
cb071dbd4f
@ -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',
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user