Skip to content

Commit 3b9accd

Browse files
committed
feat: add timeout support to RequestContext and IsomorphicFetchHttpLibrary
1 parent 67d6aa4 commit 3b9accd

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

src/gen/http/http.ts

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gen/http/isomorphic-fetch.ts

Lines changed: 22 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/testTimeout.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { RequestContext, HttpMethod } from '../src/gen/http/http.ts';
2+
import { IsomorphicFetchHttpLibrary } from '../src/gen/http/isomorphic-fetch.ts';
3+
4+
const http = new IsomorphicFetchHttpLibrary();
5+
6+
// URL that delays response for 5 seconds
7+
const req = new RequestContext('https://httpbin.org/delay/5', HttpMethod.GET);
8+
req.setTimeout(2000); // 2s timeout
9+
10+
http.send(req)
11+
.toPromise?.()
12+
.then(console.log)
13+
.catch((err) => console.error('TIMED OUT:', err));

0 commit comments

Comments
 (0)