diff --git a/whatwg-fetch/whatwg-fetch-tests.ts b/whatwg-fetch/whatwg-fetch-tests.ts index a7ba5d05c..3f29746ed 100644 --- a/whatwg-fetch/whatwg-fetch-tests.ts +++ b/whatwg-fetch/whatwg-fetch-tests.ts @@ -28,6 +28,17 @@ function test_fetchUrl() { handlePromise(window.fetch("http://www.andlabs.net/html5/uCOR.php")); } +function test_fetchUrlWithRequestObject() { + var requestOptions: RequestInit = { + method: "POST", + headers: { + 'Content-Type': 'application/json' + } + }; + var request: Request = new Request("http://www.andlabs.net/html5/uCOR.php", requestOptions); + handlePromise(window.fetch(request)); +} + function handlePromise(promise: Promise) { promise.then((response) => { if (response.type === 'basis') { diff --git a/whatwg-fetch/whatwg-fetch.d.ts b/whatwg-fetch/whatwg-fetch.d.ts index f98fb5985..4d47904a2 100644 --- a/whatwg-fetch/whatwg-fetch.d.ts +++ b/whatwg-fetch/whatwg-fetch.d.ts @@ -80,5 +80,5 @@ declare type BodyInit = Blob|FormData|string; declare type RequestInfo = Request|string; interface Window { - fetch(url: string, init?: RequestInit): Promise; + fetch(url: string|Request, init?: RequestInit): Promise; }