@podium/client
Advanced tools
Comparing version 5.1.10-next.1 to 5.1.10-next.2
@@ -0,1 +1,8 @@ | ||
## [5.1.10-next.2](https://github.com/podium-lib/client/compare/v5.1.10-next.1...v5.1.10-next.2) (2024-08-26) | ||
### Bug Fixes | ||
* use AbortController instead of AbortSignal to avoid unhandled exception ([#412](https://github.com/podium-lib/client/issues/412)) ([87f5ffe](https://github.com/podium-lib/client/commit/87f5ffe553aa49189658a9be0e19d1323878a55a)) | ||
## [5.1.10-next.1](https://github.com/podium-lib/client/compare/v5.1.9...v5.1.10-next.1) (2024-08-22) | ||
@@ -2,0 +9,0 @@ |
@@ -25,11 +25,21 @@ import { request as undiciRequest } from 'undici'; | ||
async request(url, options) { | ||
const { statusCode, headers, body } = await this.requestFn( | ||
new URL(url), | ||
{ | ||
...options, | ||
signal: AbortSignal.timeout(options.timeout || 1000), | ||
}, | ||
); | ||
return { statusCode, headers, body }; | ||
const abortController = new AbortController(); | ||
const timeoutId = setTimeout(() => { | ||
abortController.abort(); | ||
}, options.timeout || 1000); | ||
try { | ||
const { statusCode, headers, body } = await this.requestFn( | ||
new URL(url), | ||
{ | ||
...options, | ||
signal: abortController.signal, | ||
}, | ||
); | ||
return { statusCode, headers, body }; | ||
} finally { | ||
clearTimeout(timeoutId); | ||
} | ||
} | ||
} |
{ | ||
"name": "@podium/client", | ||
"version": "5.1.10-next.1", | ||
"version": "5.1.10-next.2", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
172522
2491