Skip to content

Commit

Permalink
Don't require custom fetch options to not be in Request to pass them …
Browse files Browse the repository at this point in the history
…explicitly
  • Loading branch information
dkokotov committed Nov 6, 2023
1 parent d7b0abc commit 096b6ea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source/core/Ky.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export class Ky {
}
}

const nonRequestOptions = findUnknownOptions(this.request, this._options);
const nonRequestOptions = findUnknownOptions(this._options);

if (this._options.timeout === false) {
return this._options.fetch(this.request.clone(), nonRequestOptions);
Expand Down
3 changes: 1 addition & 2 deletions source/utils/options.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {kyOptionKeys, requestOptionsRegistry} from '../core/constants.js';

export const findUnknownOptions = (
request: Request,
options: Record<string, unknown>,
): Record<string, unknown> => {
const unknownOptions: Record<string, unknown> = {};

for (const key in options) {
if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && !(key in request)) {
if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys)) {
unknownOptions[key] = options[key];
}
}
Expand Down

0 comments on commit 096b6ea

Please sign in to comment.