@wooksjs/http-body 0.2.12 → 0.2.14
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.cjs +2 -14
- package/dist/index.mjs +2 -14
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -27,18 +27,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const banner = () => `[${"@wooksjs/http-body"}][${new Date().toISOString().replace('T', ' ').replace(/\.\d{3}z$/i, '')}] `;
|
|
31
|
-
|
|
32
|
-
/* istanbul ignore file */
|
|
33
|
-
function logError(error) {
|
|
34
|
-
console.error('[91m' + '[1m' + banner() + error + '[0m');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function panic(error) {
|
|
38
|
-
logError(error);
|
|
39
|
-
return new Error(error);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
30
|
const compressors = {
|
|
43
31
|
identity: {
|
|
44
32
|
compress: v => v,
|
|
@@ -50,7 +38,7 @@ function uncompressBody(encodings, body) {
|
|
|
50
38
|
let newBody = body;
|
|
51
39
|
for (const e of encodings.reverse()) {
|
|
52
40
|
if (!compressors[e]) {
|
|
53
|
-
throw
|
|
41
|
+
throw new Error(`Usupported compression type "${e}".`);
|
|
54
42
|
}
|
|
55
43
|
newBody = yield compressors[e].uncompress(body);
|
|
56
44
|
}
|
|
@@ -181,7 +169,7 @@ function useBody() {
|
|
|
181
169
|
}
|
|
182
170
|
function registerBodyCompressor(name, compressor) {
|
|
183
171
|
if (compressors[name]) {
|
|
184
|
-
throw
|
|
172
|
+
throw new Error(`Body compressor "${name}" already registered.`);
|
|
185
173
|
}
|
|
186
174
|
compressors[name] = compressor;
|
|
187
175
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -25,18 +25,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const banner = () => `[${"@wooksjs/http-body"}][${new Date().toISOString().replace('T', ' ').replace(/\.\d{3}z$/i, '')}] `;
|
|
29
|
-
|
|
30
|
-
/* istanbul ignore file */
|
|
31
|
-
function logError(error) {
|
|
32
|
-
console.error('[91m' + '[1m' + banner() + error + '[0m');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function panic(error) {
|
|
36
|
-
logError(error);
|
|
37
|
-
return new Error(error);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
28
|
const compressors = {
|
|
41
29
|
identity: {
|
|
42
30
|
compress: v => v,
|
|
@@ -48,7 +36,7 @@ function uncompressBody(encodings, body) {
|
|
|
48
36
|
let newBody = body;
|
|
49
37
|
for (const e of encodings.reverse()) {
|
|
50
38
|
if (!compressors[e]) {
|
|
51
|
-
throw
|
|
39
|
+
throw new Error(`Usupported compression type "${e}".`);
|
|
52
40
|
}
|
|
53
41
|
newBody = yield compressors[e].uncompress(body);
|
|
54
42
|
}
|
|
@@ -179,7 +167,7 @@ function useBody() {
|
|
|
179
167
|
}
|
|
180
168
|
function registerBodyCompressor(name, compressor) {
|
|
181
169
|
if (compressors[name]) {
|
|
182
|
-
throw
|
|
170
|
+
throw new Error(`Body compressor "${name}" already registered.`);
|
|
183
171
|
}
|
|
184
172
|
compressors[name] = compressor;
|
|
185
173
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wooksjs/http-body",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "@wooksjs/http-body",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"url": "https://github.com/wooksjs/wooksjs/issues"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@wooksjs/event-http": "0.2.
|
|
34
|
+
"@wooksjs/event-http": "0.2.14"
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/wooksjs/wooksjs/tree/main/packages/http-body#readme"
|
|
37
37
|
}
|