@podium/client
Advanced tools
Comparing version 5.1.10-next.2 to 5.1.10
@@ -1,2 +0,2 @@ | ||
## [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) | ||
## [5.1.10](https://github.com/podium-lib/client/compare/v5.1.9...v5.1.10) (2024-09-06) | ||
@@ -6,11 +6,4 @@ | ||
* 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)) | ||
* **deps:** update dependency @podium/utils to v5.2.0 ([f7d4675](https://github.com/podium-lib/client/commit/f7d4675e6e2b9f2fba26cbd164d3e7a73b9c132e)) | ||
## [5.1.10-next.1](https://github.com/podium-lib/client/compare/v5.1.9...v5.1.10-next.1) (2024-08-22) | ||
### Bug Fixes | ||
* use AbortSignal to ensure timeouts are respected ([08899d9](https://github.com/podium-lib/client/commit/08899d974246037cb1893a5b6d06bd6df58815e2)) | ||
## [5.1.9](https://github.com/podium-lib/client/compare/v5.1.8...v5.1.9) (2024-08-19) | ||
@@ -17,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { request as undiciRequest } from 'undici'; | ||
import { request } from 'undici'; | ||
@@ -10,2 +10,3 @@ /** | ||
* @property {number} [timeout] | ||
* @property {number} [bodyTimeout] | ||
* @property {object} [query] | ||
@@ -16,6 +17,2 @@ * @property {import('http').IncomingHttpHeaders} [headers] | ||
export default class HTTP { | ||
constructor(requestFn = undiciRequest) { | ||
this.requestFn = requestFn; | ||
} | ||
/** | ||
@@ -27,21 +24,8 @@ * @param {string} url | ||
async request(url, options) { | ||
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); | ||
} | ||
const { statusCode, headers, body } = await request( | ||
new URL(url), | ||
options, | ||
); | ||
return { statusCode, headers, body }; | ||
} | ||
} |
@@ -139,3 +139,3 @@ import { pipeline } from 'stream'; | ||
rejectUnauthorized: outgoing.rejectUnauthorized, | ||
timeout: outgoing.timeout, | ||
bodyTimeout: outgoing.timeout, | ||
method: 'GET', | ||
@@ -271,3 +271,2 @@ query: outgoing.reqOptions.query, | ||
// @ts-ignore | ||
pipeline([body, outgoing], (err) => { | ||
@@ -274,0 +273,0 @@ if (err) { |
{ | ||
"name": "@podium/client", | ||
"version": "5.1.10-next.2", | ||
"version": "5.1.10", | ||
"type": "module", | ||
@@ -43,3 +43,3 @@ "license": "MIT", | ||
"@podium/schemas": "5.0.6", | ||
"@podium/utils": "5.1.0", | ||
"@podium/utils": "5.2.0", | ||
"abslog": "2.4.4", | ||
@@ -55,6 +55,6 @@ "http-cache-semantics": "^4.0.3", | ||
"@semantic-release/git": "10.0.1", | ||
"@semantic-release/github": "10.0.6", | ||
"@semantic-release/github": "10.1.7", | ||
"@semantic-release/npm": "12.0.1", | ||
"@semantic-release/release-notes-generator": "13.0.0", | ||
"@sinonjs/fake-timers": "11.2.2", | ||
"@sinonjs/fake-timers": "11.3.1", | ||
"@types/readable-stream": "4.0.15", | ||
@@ -67,6 +67,6 @@ "benchmark": "2.1.4", | ||
"get-stream": "9.0.1", | ||
"globals": "15.8.0", | ||
"globals": "15.9.0", | ||
"http-proxy": "1.18.1", | ||
"is-stream": "4.0.1", | ||
"npm-run-all2": "5.0.0", | ||
"npm-run-all2": "5.0.2", | ||
"prettier": "3.3.2", | ||
@@ -73,0 +73,0 @@ "semantic-release": "23.1.1", |
@@ -8,2 +8,3 @@ /** | ||
* @property {number} [timeout] | ||
* @property {number} [bodyTimeout] | ||
* @property {object} [query] | ||
@@ -13,4 +14,2 @@ * @property {import('http').IncomingHttpHeaders} [headers] | ||
export default class HTTP { | ||
constructor(requestFn?: typeof undiciRequest); | ||
requestFn: typeof undiciRequest; | ||
/** | ||
@@ -29,5 +28,5 @@ * @param {string} url | ||
timeout?: number; | ||
bodyTimeout?: number; | ||
query?: object; | ||
headers?: import('http').IncomingHttpHeaders; | ||
}; | ||
import { request as undiciRequest } from 'undici'; |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
171598
2476
+ Added@podium/utils@5.2.0(transitive)
- Removed@podium/utils@5.1.0(transitive)
Updated@podium/utils@5.2.0