11import { createWriteStream , existsSync , mkdirSync , unlink } from "fs" ;
22import { Readable } from "stream" ;
3- import { get , IncomingMessage } from "http " ;
4- import { get as sGet } from "https " ;
3+ import { http , https } from "follow-redirects " ;
4+ import { IncomingMessage } from "http " ;
55import { URL } from "url" ;
66import {
77 createUnzip ,
@@ -22,8 +22,10 @@ const CSSGetError = class extends Error {
2222 super ( overrideMsg || response . statusMessage || "CSSGetError: " ) ;
2323
2424 this . name = "CSSGetError" ;
25- this . message = overrideMsg || response . statusMessage || "" ;
26- this . code = response . statusCode || 200 ;
25+ this . code = response . statusCode ?? 200 ;
26+ this . message =
27+ `Response Status Code: ${ this . code } , Message: ` +
28+ ( overrideMsg ?? response . statusMessage ?? "" ) ;
2729 }
2830} ;
2931
@@ -38,10 +40,10 @@ const CSSGetError = class extends Error {
3840export const fetchAndCacheAsset = ( url : string ) =>
3941 new Promise < void > ( ( res , rej ) => {
4042 const _url = new URL ( url ) ;
41- let httpGet = sGet ;
43+ let httpGet = https . get ;
4244
4345 if ( _url . protocol === "http:" ) {
44- httpGet = get ;
46+ httpGet = http . get ;
4547 }
4648
4749 httpGet (
0 commit comments