@wooksjs/http-body 0.6.0 → 0.6.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.
- package/dist/index.cjs +6 -7
- package/dist/index.mjs +5 -5
- package/package.json +6 -5
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
//#region rolldown:runtime
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
@@ -62,10 +61,10 @@ function useBody() {
|
|
|
62
61
|
const body = await rawBody();
|
|
63
62
|
const sBody = body.toString();
|
|
64
63
|
if (isJson()) return jsonParser(sBody);
|
|
65
|
-
else if (isFormData()) return formDataParser(sBody);
|
|
66
|
-
else if (isUrlencoded()) return urlEncodedParser(sBody);
|
|
67
|
-
else if (isBinary()) return textParser(sBody);
|
|
68
|
-
else return textParser(sBody);
|
|
64
|
+
else if (isFormData()) return formDataParser(sBody);
|
|
65
|
+
else if (isUrlencoded()) return urlEncodedParser(sBody);
|
|
66
|
+
else if (isBinary()) return textParser(sBody);
|
|
67
|
+
else return textParser(sBody);
|
|
69
68
|
});
|
|
70
69
|
function jsonParser(v) {
|
|
71
70
|
try {
|
|
@@ -80,7 +79,7 @@ else return textParser(sBody);
|
|
|
80
79
|
function formDataParser(v) {
|
|
81
80
|
const MAX_PARTS = 255;
|
|
82
81
|
const MAX_KEY_LENGTH = 100;
|
|
83
|
-
const MAX_VALUE_LENGTH =
|
|
82
|
+
const MAX_VALUE_LENGTH = 100 * 1024;
|
|
84
83
|
const boundary = `--${(/boundary=([^;]+)(?:;|$)/u.exec(contentType || "") || [, ""])[1]}`;
|
|
85
84
|
if (!boundary) throw new __wooksjs_event_http.HttpError(__wooksjs_event_http.EHttpStatusCode.BadRequest, "form-data boundary not recognized");
|
|
86
85
|
const parts = v.trim().split(boundary);
|
|
@@ -147,4 +146,4 @@ else return textParser(sBody);
|
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
//#endregion
|
|
150
|
-
exports.useBody = useBody
|
|
149
|
+
exports.useBody = useBody;
|
package/dist/index.mjs
CHANGED
|
@@ -38,10 +38,10 @@ function useBody() {
|
|
|
38
38
|
const body = await rawBody();
|
|
39
39
|
const sBody = body.toString();
|
|
40
40
|
if (isJson()) return jsonParser(sBody);
|
|
41
|
-
else if (isFormData()) return formDataParser(sBody);
|
|
42
|
-
else if (isUrlencoded()) return urlEncodedParser(sBody);
|
|
43
|
-
else if (isBinary()) return textParser(sBody);
|
|
44
|
-
else return textParser(sBody);
|
|
41
|
+
else if (isFormData()) return formDataParser(sBody);
|
|
42
|
+
else if (isUrlencoded()) return urlEncodedParser(sBody);
|
|
43
|
+
else if (isBinary()) return textParser(sBody);
|
|
44
|
+
else return textParser(sBody);
|
|
45
45
|
});
|
|
46
46
|
function jsonParser(v) {
|
|
47
47
|
try {
|
|
@@ -56,7 +56,7 @@ else return textParser(sBody);
|
|
|
56
56
|
function formDataParser(v) {
|
|
57
57
|
const MAX_PARTS = 255;
|
|
58
58
|
const MAX_KEY_LENGTH = 100;
|
|
59
|
-
const MAX_VALUE_LENGTH =
|
|
59
|
+
const MAX_VALUE_LENGTH = 100 * 1024;
|
|
60
60
|
const boundary = `--${(/boundary=([^;]+)(?:;|$)/u.exec(contentType || "") || [, ""])[1]}`;
|
|
61
61
|
if (!boundary) throw new HttpError(EHttpStatusCode.BadRequest, "form-data boundary not recognized");
|
|
62
62
|
const parts = v.trim().split(boundary);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wooksjs/http-body",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "@wooksjs/http-body",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -39,11 +39,12 @@
|
|
|
39
39
|
"url": "https://github.com/wooksjs/wooksjs/issues"
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://github.com/wooksjs/wooksjs/tree/main/packages/http-body#readme",
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@wooksjs/event-http": "^0.6.1"
|
|
44
|
+
},
|
|
42
45
|
"devDependencies": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"vitest": "^2.1.8",
|
|
46
|
-
"@wooksjs/event-http": "^0.6.0"
|
|
46
|
+
"typescript": "^5.8.3",
|
|
47
|
+
"vitest": "^3.2.4"
|
|
47
48
|
},
|
|
48
49
|
"scripts": {
|
|
49
50
|
"build": "rolldown -c ../../rolldown.config.mjs"
|