Merge pull request #5732 from arusakov/whatwg-fetch_strings

whatwg-fetch strings enums declaration
This commit is contained in:
Masahiro Wakame
2015-09-27 13:10:04 +09:00
2 changed files with 15 additions and 9 deletions
+7 -1
View File
@@ -6,7 +6,10 @@ function test_fetchUrlWithOptions() {
headers.append("Content-Type", "application/json");
var requestOptions: RequestInit = {
method: "POST",
headers: headers
headers: headers,
mode: 'same-origin',
credentials: 'omit',
cache: 'default'
};
handlePromise(window.fetch("http://www.andlabs.net/html5/uCOR.php", requestOptions));
}
@@ -27,6 +30,9 @@ function test_fetchUrl() {
function handlePromise(promise: Promise<Response>) {
promise.then((response) => {
if (response.type === 'basis') {
// for test only
}
return response.text();
}).then((text) => {
console.log(text);
+8 -8
View File
@@ -10,20 +10,20 @@ declare class Request {
method: string;
url: string;
headers: Headers;
context: RequestContext;
context: string|RequestContext;
referrer: string;
mode: RequestMode;
credentials: RequestCredentials;
cache: RequestCache;
mode: string|RequestMode;
credentials: string|RequestCredentials;
cache: string|RequestCache;
}
interface RequestInit {
method?: string;
headers?: HeaderInit|{ [index: string]: string };
body?: BodyInit;
mode?: RequestMode;
credentials?: RequestCredentials;
cache?: RequestCache;
mode?: string|RequestMode;
credentials?: string|RequestCredentials;
cache?: string|RequestCache;
}
declare enum RequestContext {
@@ -58,7 +58,7 @@ declare class Response extends Body {
constructor(body?: BodyInit, init?: ResponseInit);
error(): Response;
redirect(url: string, status: number): Response;
type: ResponseType;
type: string|ResponseType;
url: string;
status: number;
ok: boolean;