mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-13 07:10:46 +00:00
fix: reject non-2xx responses in Fly.io token validation (#1614)
testFlyToken() fallback to /v1/user accepted 404 plain text responses because hasError() only checks for JSON "error"/"errors" keys. Adding resp.ok check ensures non-2xx responses are correctly rejected. Co-authored-by: Claude <claude@anthropic.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
01e5fa842d
commit
d69c4f0f02
2 changed files with 5 additions and 3 deletions
|
|
@ -143,8 +143,10 @@ async function testFlyToken(): Promise<boolean> {
|
|||
headers: { Authorization: authHeader },
|
||||
signal: AbortSignal.timeout(10_000),
|
||||
});
|
||||
const text = await resp.text();
|
||||
if (text && !hasError(text)) return true;
|
||||
if (resp.ok) {
|
||||
const text = await resp.text();
|
||||
if (text && !hasError(text)) return true;
|
||||
}
|
||||
} catch {
|
||||
// fall through
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue