Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow URL class object as an argument for fetch() #1696

Merged
merged 2 commits into from Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion @types/index.d.ts
Expand Up @@ -145,7 +145,7 @@ export interface Body extends Pick<BodyMixin, keyof BodyMixin> {}

export type RequestRedirect = 'error' | 'follow' | 'manual';
export type ReferrerPolicy = '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'same-origin' | 'origin' | 'strict-origin' | 'origin-when-cross-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
export type RequestInfo = string | Request;
export type RequestInfo = string | URL | Request;
LinusU marked this conversation as resolved.
Show resolved Hide resolved
export class Request extends BodyMixin {
constructor(input: RequestInfo, init?: RequestInit);

Expand Down
1 change: 1 addition & 0 deletions @types/index.test-d.ts
Expand Up @@ -7,6 +7,7 @@ import * as _fetch from '.';

async function run() {
const getResponse = await fetch('https://bigfile.com/test.zip');
await fetch(new URL('https://bigfile.com/test.zip'));
expectType<boolean>(getResponse.ok);
expectType<number>(getResponse.size);
expectType<number>(getResponse.status);
Expand Down