xjs-node 3.0.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -224,7 +224,7 @@ class HttpResolverContext {
|
|
|
224
224
|
const stream = fs.createWriteStream(dest);
|
|
225
225
|
res.pipe(stream);
|
|
226
226
|
stream.on("finish", () => stream.close());
|
|
227
|
-
stream.on("close", () => resolve({ headers: res.headers }));
|
|
227
|
+
stream.on("close", () => resolve({ headers: res.headers, status: res.statusCode }));
|
|
228
228
|
stream.on("error", e => this.handleError(reject, e, "an error occurred on donwloading stream."));
|
|
229
229
|
return;
|
|
230
230
|
}
|
|
@@ -248,13 +248,7 @@ class HttpResolverContext {
|
|
|
248
248
|
else if (contentEncofing == "br")
|
|
249
249
|
retBuf = zlib.brotliDecompressSync(retBuf);
|
|
250
250
|
const data = rc.responseType === "buffer" ? retBuf : retBuf.toString("utf8");
|
|
251
|
-
|
|
252
|
-
if (xjs_common_1.UType.isString(data) && data.trim())
|
|
253
|
-
this.warn(data);
|
|
254
|
-
reject(new xjs_common_1.XjsErr(s_errCode, `Https received an error status ${res.statusCode}`));
|
|
255
|
-
}
|
|
256
|
-
else
|
|
257
|
-
resolve({ payload: data, headers: res.headers });
|
|
251
|
+
resolve({ payload: data, headers: res.headers, status: res.statusCode });
|
|
258
252
|
}
|
|
259
253
|
catch (e) {
|
|
260
254
|
this.handleError(reject, e, "something went wrong in processing response.");
|