Skip to content

Commit

Permalink
Fix an issue in firefox where the body option was being detected as a…
Browse files Browse the repository at this point in the history
…n unknown option
  • Loading branch information
kdelmonte committed Oct 27, 2023
1 parent 1a20029 commit 9485d30
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions source/core/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]);
4 changes: 2 additions & 2 deletions source/utils/options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {kyOptionKeys} from '../core/constants.js';
import {kyOptionKeys, requestOptions} from '../core/constants.js';

export const findUnknownOptions = (
request: Request,
Expand All @@ -7,7 +7,7 @@ export const findUnknownOptions = (
const unknownOptions: Record<string, unknown> = {};

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];
}
}
Expand Down

0 comments on commit 9485d30

Please sign in to comment.