diff --git a/classes/ResponseError.class.js b/classes/ResponseError.class.js index b32da23..535d72e 100644 --- a/classes/ResponseError.class.js +++ b/classes/ResponseError.class.js @@ -25,6 +25,7 @@ class ResponseError extends Error { this.response = response } + get statusCode () { return this.response.code } get responseText () { return this.response.responseText } get buffer () { return this.response.buffer } diff --git a/test/classes/ResponseError.class.test.js b/test/classes/ResponseError.class.test.js index c1272e6..1d3066a 100644 --- a/test/classes/ResponseError.class.test.js +++ b/test/classes/ResponseError.class.test.js @@ -51,6 +51,18 @@ describe('ResponseError', () => { expect(responeError.stats).to.equal(response) })) + describe('get statusCode', () => it('should return the value of response', () => { + const responeError = new ResponseError('Error Message', response) + + expect(responeError.statusCode).to.equal(response.statusCode) + })) + + describe('get responseText', () => it('should return the value of response', () => { + const responeError = new ResponseError('Error Message', response) + + expect(responeError.responseText).to.equal(response.responseText) + })) + describe('get buffer', () => it('should return the value of response', () => { const responeError = new ResponseError('Error Message', response)