mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 06:50:19 +00:00
Merge pull request #5732 from arusakov/whatwg-fetch_strings
whatwg-fetch strings enums declaration
This commit is contained in:
@@ -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);
|
||||
|
||||
Vendored
+8
-8
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user