vafast 0.1.4 → 0.1.5
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 +21 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -51852,31 +51852,30 @@ var import_qs = __toESM(require_lib2(), 1);
|
|
|
51852
51852
|
var import_cookie = __toESM(require_dist(), 1);
|
|
51853
51853
|
async function parseBody(req) {
|
|
51854
51854
|
const contentType = req.headers.get("content-type") || "";
|
|
51855
|
-
|
|
51856
|
-
|
|
51857
|
-
if (contentLength && parseInt(contentLength) > maxSize) {
|
|
51858
|
-
throw new Error(`\u8BF7\u6C42\u4F53\u8FC7\u5927: ${contentLength} bytes (\u6700\u5927\u5141\u8BB8: ${maxSize} bytes)`);
|
|
51859
|
-
}
|
|
51860
|
-
try {
|
|
51861
|
-
if (contentType.includes("application/json")) {
|
|
51855
|
+
if (contentType.includes("application/json")) {
|
|
51856
|
+
try {
|
|
51862
51857
|
return await req.json();
|
|
51858
|
+
} catch {
|
|
51859
|
+
return;
|
|
51863
51860
|
}
|
|
51864
|
-
|
|
51865
|
-
|
|
51866
|
-
|
|
51867
|
-
|
|
51868
|
-
|
|
51869
|
-
|
|
51870
|
-
|
|
51871
|
-
|
|
51872
|
-
|
|
51873
|
-
}
|
|
51874
|
-
if (contentType.includes("application/octet-stream")) {
|
|
51875
|
-
return await req.arrayBuffer();
|
|
51876
|
-
}
|
|
51861
|
+
}
|
|
51862
|
+
if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
51863
|
+
const text2 = await req.text();
|
|
51864
|
+
return Object.fromEntries(new URLSearchParams(text2));
|
|
51865
|
+
}
|
|
51866
|
+
if (contentType.includes("multipart/form-data")) {
|
|
51867
|
+
return await parseMultipartFormData(req);
|
|
51868
|
+
}
|
|
51869
|
+
if (contentType.includes("text/plain")) {
|
|
51877
51870
|
return await req.text();
|
|
51878
|
-
}
|
|
51879
|
-
|
|
51871
|
+
}
|
|
51872
|
+
if (contentType.includes("application/octet-stream")) {
|
|
51873
|
+
return await req.arrayBuffer();
|
|
51874
|
+
}
|
|
51875
|
+
try {
|
|
51876
|
+
return await req.text();
|
|
51877
|
+
} catch {
|
|
51878
|
+
return;
|
|
51880
51879
|
}
|
|
51881
51880
|
}
|
|
51882
51881
|
async function parseMultipartFormData(req) {
|