@fudrouter/fsrouter 0.6.115 → 0.6.116

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.
@@ -121,10 +121,10 @@ export async function POST_handler(req, res) {
121
121
  }
122
122
  });
123
123
  if (probeRes.ok)
124
- return probeRes.json({ valid: true });
124
+ return res.json({ valid: true });
125
125
  // Auth errors - no point trying chat fallback
126
126
  if (probeRes.status === 401 || probeRes.status === 403) {
127
- return probeRes.json({ valid: false, error: "API key unauthorized" });
127
+ return res.json({ valid: false, error: "API key unauthorized" });
128
128
  }
129
129
  // Fallback: try chat/completions if modelId provided
130
130
  if (modelId) {
@@ -143,15 +143,15 @@ export async function POST_handler(req, res) {
143
143
  })
144
144
  });
145
145
  if (chatRes.ok) {
146
- return probeRes.json({ valid: true, method: "chat" });
146
+ return res.json({ valid: true, method: "chat" });
147
147
  }
148
- return probeRes.json({
148
+ return res.json({
149
149
  valid: false,
150
150
  error: getChatErrorMessage(chatRes.status),
151
151
  method: "chat"
152
152
  });
153
153
  }
154
- return probeRes.json({ valid: false, error: getModelsErrorMessage(probeRes.status) });
154
+ return res.json({ valid: false, error: getModelsErrorMessage(probeRes.status) });
155
155
  }
156
156
  // OpenAI Compatible Validation (Default)
157
157
  const modelsUrl = `${baseUrl.replace(/\/$/, "")}/models`;
@@ -159,10 +159,10 @@ export async function POST_handler(req, res) {
159
159
  headers: { "Authorization": `Bearer ${apiKey}` },
160
160
  });
161
161
  if (probeRes.ok)
162
- return probeRes.json({ valid: true });
162
+ return res.json({ valid: true });
163
163
  // Auth errors - no point trying chat fallback
164
164
  if (probeRes.status === 401 || probeRes.status === 403) {
165
- return probeRes.json({ valid: false, error: "API key unauthorized" });
165
+ return res.json({ valid: false, error: "API key unauthorized" });
166
166
  }
167
167
  // Fallback: try chat/completions if modelId provided
168
168
  if (modelId) {
@@ -179,7 +179,7 @@ export async function POST_handler(req, res) {
179
179
  })
180
180
  });
181
181
  if (chatRes.ok) {
182
- return probeRes.json({ valid: true, method: "chat" });
182
+ return res.json({ valid: true, method: "chat" });
183
183
  }
184
184
  return res.json({
185
185
  valid: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fudrouter/fsrouter",
3
- "version": "0.6.115",
3
+ "version": "0.6.116",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "9Router v2 — Express Backend (API, SSE, DB, Auth, MITM)",