befly 3.7.6 → 3.7.7

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/package.json +2 -2
  2. package/router/api.ts +6 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "befly",
3
- "version": "3.7.6",
3
+ "version": "3.7.7",
4
4
  "description": "Befly - 为 Bun 专属打造的 TypeScript API 接口框架核心引擎",
5
5
  "type": "module",
6
6
  "private": false,
@@ -69,5 +69,5 @@
69
69
  "es-toolkit": "^1.41.0",
70
70
  "pathe": "^2.0.3"
71
71
  },
72
- "gitHead": "4eea00fa16a2fe89457480d0460ea75a9b572255"
72
+ "gitHead": "1716a6a3931dc231b8ac5a993b81e5de415bf596"
73
73
  }
package/router/api.ts CHANGED
@@ -99,6 +99,12 @@ export function apiHandler(apiRoutes: Map<string, ApiRoute>, pluginLists: Plugin
99
99
  const result = await api.handler(appContext, ctx, req);
100
100
 
101
101
  // 11. 返回响应
102
+ // 🔥 新增:直接返回 Response 对象
103
+ if (result instanceof Response) {
104
+ return result;
105
+ }
106
+
107
+ // 12. 返回响应
102
108
  if (result && typeof result === 'object' && 'code' in result) {
103
109
  // 处理 BigInt 序列化问题
104
110
  const jsonString = JSON.stringify(result, (key, value) => (typeof value === 'bigint' ? value.toString() : value));