Skip to content

Commit 6de5562

Browse files
Copilotbarjin
andcommitted
feat: add AbortSignal and rename timeouttimeoutMillis in SendRequestOptions
Co-authored-by: barjin <61918049+barjin@users.noreply.github.com>
1 parent 7751403 commit 6de5562

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

test/core/base-http-client.test.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ describe('BaseHttpClient signal and timeoutMillis options', () => {
3737
const controller = new AbortController();
3838
controller.abort();
3939

40-
await expect(
41-
httpClient.sendRequest(new Request(url), { signal: controller.signal }),
42-
).rejects.toThrow();
40+
await expect(httpClient.sendRequest(new Request(url), { signal: controller.signal })).rejects.toThrow();
4341
});
4442

4543
test('aborts when the signal is aborted after the request starts', async () => {
@@ -54,9 +52,7 @@ describe('BaseHttpClient signal and timeoutMillis options', () => {
5452
const slowUrl = `http://127.0.0.1:${(slowServer.address() as AddressInfo).port}`;
5553

5654
try {
57-
await expect(
58-
httpClient.sendRequest(new Request(slowUrl), { signal: controller.signal }),
59-
).rejects.toThrow();
55+
await expect(httpClient.sendRequest(new Request(slowUrl), { signal: controller.signal })).rejects.toThrow();
6056
} finally {
6157
await new Promise((r) => slowServer.close(r));
6258
}
@@ -71,9 +67,7 @@ describe('BaseHttpClient signal and timeoutMillis options', () => {
7167
const slowUrl = `http://127.0.0.1:${(slowServer.address() as AddressInfo).port}`;
7268

7369
try {
74-
await expect(
75-
httpClient.sendRequest(new Request(slowUrl), { timeoutMillis: 50 }),
76-
).rejects.toThrow();
70+
await expect(httpClient.sendRequest(new Request(slowUrl), { timeoutMillis: 50 })).rejects.toThrow();
7771
} finally {
7872
await new Promise((r) => slowServer.close(r));
7973
}

0 commit comments

Comments
 (0)