Merge pull request #5998 from subash-a/corrected-fetch-typedef

corrected fetch args to support Request
This commit is contained in:
Masahiro Wakame
2015-09-27 13:12:13 +09:00
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -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<Response>) {
promise.then((response) => {
if (response.type === 'basis') {
+1 -1
View File
@@ -80,5 +80,5 @@ declare type BodyInit = Blob|FormData|string;
declare type RequestInfo = Request|string;
interface Window {
fetch(url: string, init?: RequestInit): Promise<Response>;
fetch(url: string|Request, init?: RequestInit): Promise<Response>;
}