@defjs/core 0.0.0-test-0010 → 0.0.0-test-0012
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.
- package/dist/index.js +13 -13
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -392,7 +392,7 @@ function makeResponse(options) {
|
|
|
392
392
|
const url = options.url ?? "";
|
|
393
393
|
const headers = options.headers ?? new Headers;
|
|
394
394
|
const body = options.body ?? null;
|
|
395
|
-
if (!ok) {
|
|
395
|
+
if (!ok || options.error) {
|
|
396
396
|
const error = options.error || new Error(`Http failure response for ${options.url}: ${status} ${statusText}`);
|
|
397
397
|
return {
|
|
398
398
|
ok: false,
|
|
@@ -518,18 +518,18 @@ async function fetchHandler(httpRequest) {
|
|
|
518
518
|
loaded: receivedLength,
|
|
519
519
|
total: contentLength
|
|
520
520
|
});
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
}
|
|
521
|
+
}
|
|
522
|
+
const chunksAll = concatChunks(chunks, receivedLength);
|
|
523
|
+
try {
|
|
524
|
+
body = parseBody(httpRequest, response2, chunksAll);
|
|
525
|
+
} catch (error) {
|
|
526
|
+
throw makeResponse({
|
|
527
|
+
error: new Error("Parse response body error", { cause: error }),
|
|
528
|
+
url,
|
|
529
|
+
status,
|
|
530
|
+
statusText,
|
|
531
|
+
headers
|
|
532
|
+
});
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
535
|
return makeResponse({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defjs/core",
|
|
3
|
-
"version": "0.0.0-test-
|
|
3
|
+
"version": "0.0.0-test-0012",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "bun run ./scripts/build.ts",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"exports": {
|
|
19
19
|
"./package.json": "./package.json",
|
|
20
20
|
".": {
|
|
21
|
-
"types": "./index.d.ts",
|
|
22
|
-
"default": "./index.js"
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|