diff --git a/source/core/constants.ts b/source/core/constants.ts index bbf43106..088ff58d 100644 --- a/source/core/constants.ts +++ b/source/core/constants.ts @@ -58,3 +58,20 @@ export const kyOptionKeys: KyOptionsRegistry = { onDownloadProgress: true, fetch: true, }; + +export const requestOptions = new Set([ + 'options', + 'method', + 'headers', + 'body', + 'mode', + 'credentials', + 'cache', + 'redirect', + 'referrer', + 'referrerPolicy', + 'integrity', + 'keepalive', + 'signal', + 'priority', +]); diff --git a/source/utils/options.ts b/source/utils/options.ts index 22c11d0a..95ae52cc 100644 --- a/source/utils/options.ts +++ b/source/utils/options.ts @@ -1,4 +1,4 @@ -import {kyOptionKeys} from '../core/constants.js'; +import {kyOptionKeys, requestOptions} from '../core/constants.js'; export const findUnknownOptions = ( request: Request, @@ -7,7 +7,7 @@ export const findUnknownOptions = ( const unknownOptions: Record = {}; for (const key in options) { - if (!(key in kyOptionKeys) && !(key in request)) { + if (!requestOptions.has(key) && !(key in kyOptionKeys) && !(key in request)) { unknownOptions[key] = options[key]; } }