Skip to content

Commit c4980f4

Browse files
MichaelDeBoeycliffordfajardoClifford FajardoGozala
authored
fix(fetch): add HTTPS Agent types to fetch & Request (#78)
* fix: add typings for HTTPS agent for fetch and Request (#18) Co-authored-by: Clifford Fajardo <[email protected]> * chore: fix changeset --------- Co-authored-by: Clifford Fajardo <[email protected]> Co-authored-by: Clifford Fajardo <[email protected]> Co-authored-by: Irakli Gozalishvili <[email protected]>
1 parent f1d9272 commit c4980f4

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

.changeset/polite-poets-enjoy.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@web-std/fetch": minor
3+
---
4+
5+
expose `RequestExtraOptions` to `fetch` & add `HTTPs.agent` to types

packages/fetch/src/fetch.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const supportedSchemas = new Set(['data:', 'http:', 'https:', 'file:']);
3333
* Fetch function
3434
*
3535
* @param {string | URL | import('./request').default} url - Absolute url or Request instance
36-
* @param {RequestInit} [options_] - Fetch options
36+
* @param {RequestInit & import('./request.js').RequestExtraOptions} [options_] - Fetch options
3737
* @return {Promise<import('./response').default>}
3838
*/
3939
async function fetch(url, options_ = {}) {
@@ -319,9 +319,9 @@ async function fetch(url, options_ = {}) {
319319
}
320320

321321
/**
322-
*
323-
* @param {import('http').ClientRequest} request
324-
* @param {(error:Error) => void} errorCallback
322+
*
323+
* @param {import('http').ClientRequest} request
324+
* @param {(error:Error) => void} errorCallback
325325
*/
326326
function fixResponseChunkedTransferBadEnding(request, errorCallback) {
327327
const LAST_CHUNK = Buffer.from('0\r\n\r\n');

packages/fetch/src/request.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const isRequest = object => {
5353
* @property {number} [highWaterMark]
5454
* @property {boolean} [insecureHTTPParser]
5555
*
56-
* @typedef {((url:URL) => import('http').Agent) | import('http').Agent} Agent
56+
* @typedef {((url:URL) => import('http').Agent | import('https').Agent) | import('http').Agent | import('https').Agent} Agent
5757
*
5858
* @typedef {Object} RequestOptions
5959
* @property {string} [method]

0 commit comments

Comments
 (0)