bruno/packages/bruno-js/src/bruno-response.js

28 lines
577 B
JavaScript
Raw Normal View History

2023-01-29 00:19:31 +01:00
class BrunoResponse {
2023-02-06 21:42:23 +01:00
constructor(res) {
this.res = res;
this.status = res ? res.status : null;
this.statusText = res ? res.statusText : null;
this.headers = res ? res.headers : null;
this.body = res ? res.data : null;
2023-01-29 00:19:31 +01:00
}
getStatus() {
return this.res ? this.res.status : null;
2023-01-29 00:19:31 +01:00
}
getHeader(name) {
return this.res && this.res.headers ? this.res.headers[name] : null;
2023-01-29 00:19:31 +01:00
}
getHeaders() {
return this.res ? this.res.headers : null;
2023-01-29 00:19:31 +01:00
}
getBody() {
return this.res ? this.res.data : null;
2023-01-29 00:19:31 +01:00
}
}
module.exports = BrunoResponse;