import type { Hooks , Response } from 'got' ; function isResponseOk ( response ) { const { statusCode } = response ; const limitStatusCode = response . request . options . followRedirect ? 299 : 399 ; return ( ( statusCode >= 200 && statusCode <= limitStatusCode ) || statusCode === 304 ) ; } export const hooks = { afterResponse : [ ( response ) : Response => { if ( isResponseOk ( response ) ) { response . request . destroy ( ) ; } return response ; } , ] , } ;