fix(discord): bound application summary probes · openclaw/openclaw@a81e3ee
steipete
·
2026-04-30
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { withFetchPreconnect } from "openclaw/plugin-sdk/test-env"; |
2 | 2 | import { describe, expect, it } from "vitest"; |
3 | | -import { fetchDiscordApplicationId, resolveDiscordPrivilegedIntentsFromFlags } from "./probe.js"; |
| 3 | +import { |
| 4 | +fetchDiscordApplicationId, |
| 5 | +fetchDiscordApplicationSummary, |
| 6 | +resolveDiscordPrivilegedIntentsFromFlags, |
| 7 | +} from "./probe.js"; |
4 | 8 | import { jsonResponse } from "./test-http-helpers.js"; |
5 | 9 | |
6 | 10 | describe("resolveDiscordPrivilegedIntentsFromFlags", () => { |
@@ -58,6 +62,22 @@ describe("resolveDiscordPrivilegedIntentsFromFlags", () => {
|
58 | 62 | expect(calls).toBe(2); |
59 | 63 | }); |
60 | 64 | |
| 65 | +it("does not retry Cloudflare HTML rate limits during application summary probes", async () => { |
| 66 | +let calls = 0; |
| 67 | +const fetcher = withFetchPreconnect(async () => { |
| 68 | +calls += 1; |
| 69 | +return new Response("<html><title>Error 1015</title></html>", { |
| 70 | +status: 429, |
| 71 | +headers: { "content-type": "text/html" }, |
| 72 | +}); |
| 73 | +}); |
| 74 | + |
| 75 | +await expect( |
| 76 | +fetchDiscordApplicationSummary("unparseable.token", 1_000, fetcher), |
| 77 | +).resolves.toBeUndefined(); |
| 78 | +expect(calls).toBe(1); |
| 79 | +}); |
| 80 | + |
61 | 81 | it("derives application id from parseable tokens before probing REST", async () => { |
62 | 82 | let calls = 0; |
63 | 83 | const fetcher = withFetchPreconnect(async () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。