RequestHook.onResponse Method

Handles the response after it is received.

class MyRequestHook extends RequestHook {
    async onResponse (event) {
        // ...
    }
}

The onResponse method's event object exposes the following properties:

Property Type Description
event.statusCode Number The response status code.
event.headers Object The response headers in a property-value form.
event.body Buffer The response body.
async onResponse (event) {
    if(event.statusCode === 200)
        console.log(event.headers['Content-Type']);
}