fix(sdk): cancel live catalog error bodies · openclaw/openclaw@7f38b1a
vincentkoc
·
2026-06-19
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -159,8 +159,10 @@ describe("provider-catalog-live-runtime", () => {
|
159 | 159 | |
160 | 160 | it("throws structured HTTP errors after releasing guarded fetches", async () => { |
161 | 161 | const release = vi.fn(async () => undefined); |
| 162 | +const response = new Response("{}", { status: 401 }); |
| 163 | +const cancel = vi.spyOn(response.body!, "cancel").mockResolvedValue(undefined); |
162 | 164 | const fetchGuardMock: MockedFunction<LiveModelCatalogFetchGuard> = vi.fn(async () => ({ |
163 | | -response: new Response("{}", { status: 401 }), |
| 165 | + response, |
164 | 166 | finalUrl: "https://provider.example.test/v1/models", |
165 | 167 | release, |
166 | 168 | })); |
@@ -173,6 +175,7 @@ describe("provider-catalog-live-runtime", () => {
|
173 | 175 | |
174 | 176 | expect(error).toBeInstanceOf(LiveModelCatalogHttpError); |
175 | 177 | expect(error).toMatchObject({ status: 401 }); |
| 178 | +expect(cancel).toHaveBeenCalledOnce(); |
176 | 179 | expect(release).toHaveBeenCalledTimes(1); |
177 | 180 | }); |
178 | 181 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。