vafast 0.1.7 → 0.1.8

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -56
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -51852,66 +51852,18 @@ 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
- try {
51856
- if (contentType.includes("application/json")) {
51857
- try {
51858
- const body = await req.json();
51859
- if (body === "" || body === null || typeof body === "object" && Object.keys(body).length === 0) {
51860
- return;
51861
- }
51862
- return body;
51863
- } catch (error) {
51864
- console.warn("JSON \u89E3\u6790\u5931\u8D25:", error);
51865
- return;
51866
- }
51867
- }
51868
- if (contentType.includes("application/x-www-form-urlencoded")) {
51869
- try {
51870
- const text2 = await req.text();
51871
- if (!text2)
51872
- return;
51873
- return Object.fromEntries(new URLSearchParams(text2));
51874
- } catch (error) {
51875
- console.warn("\u8868\u5355\u6570\u636E\u89E3\u6790\u5931\u8D25:", error);
51876
- return;
51877
- }
51878
- }
51879
- if (contentType.includes("multipart/form-data")) {
51880
- try {
51881
- return await parseMultipartFormData(req);
51882
- } catch (error) {
51883
- console.warn("\u6587\u4EF6\u4E0A\u4F20\u89E3\u6790\u5931\u8D25:", error);
51884
- return;
51885
- }
51886
- }
51887
- if (contentType.includes("text/plain")) {
51888
- try {
51889
- const text2 = await req.text();
51890
- return text2 || undefined;
51891
- } catch (error) {
51892
- console.warn("\u6587\u672C\u89E3\u6790\u5931\u8D25:", error);
51893
- return;
51894
- }
51895
- }
51896
- if (contentType.includes("application/octet-stream")) {
51897
- try {
51898
- return await req.arrayBuffer();
51899
- } catch (error) {
51900
- console.warn("\u4E8C\u8FDB\u5236\u6570\u636E\u89E3\u6790\u5931\u8D25:", error);
51901
- return;
51902
- }
51903
- }
51855
+ if (contentType.includes("application/json")) {
51904
51856
  try {
51905
- const text2 = await req.text();
51906
- return text2 || undefined;
51907
- } catch (error) {
51908
- console.warn("\u9ED8\u8BA4\u6587\u672C\u89E3\u6790\u5931\u8D25:", error);
51857
+ return await req.json();
51858
+ } catch {
51909
51859
  return;
51910
51860
  }
51911
- } catch (error) {
51912
- console.error("parseBody \u53D1\u751F\u672A\u9884\u671F\u9519\u8BEF:", error);
51913
- return;
51914
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
+ return await req.text();
51915
51867
  }
51916
51868
  async function parseMultipartFormData(req) {
51917
51869
  const formData = await req.formData();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vafast",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "专为Bun构建的极简结构化Web框架。Go风格,函数优先。",
5
5
  "type": "module",
6
6
  "repository": {