mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-02 21:51:46 +08:00
42 lines
1 KiB
TypeScript
42 lines
1 KiB
TypeScript
/**
|
|
* @dnscontrol-auto-doc-comment language-reference/top-level-functions/FETCH.md
|
|
*/
|
|
declare function FETCH(
|
|
url: string,
|
|
init?: {
|
|
method?:
|
|
| 'GET'
|
|
| 'POST'
|
|
| 'PUT'
|
|
| 'PATCH'
|
|
| 'DELETE'
|
|
| 'HEAD'
|
|
| 'OPTIONS';
|
|
headers?: { [key: string]: string | string[] };
|
|
// Ignored by the underlying code
|
|
// redirect: 'follow' | 'error' | 'manual';
|
|
body?: string;
|
|
}
|
|
): Promise<FetchResponse>;
|
|
|
|
interface FetchResponse {
|
|
readonly bodyUsed: boolean;
|
|
readonly headers: ResponseHeaders;
|
|
readonly ok: boolean;
|
|
readonly status: number;
|
|
readonly statusText: string;
|
|
readonly type: string;
|
|
|
|
text(): Promise<string>;
|
|
json(): Promise<any>;
|
|
}
|
|
|
|
interface ResponseHeaders {
|
|
get(name: string): string | undefined;
|
|
getAll(name: string): string[];
|
|
has(name: string): boolean;
|
|
|
|
append(name: string, value: string): void;
|
|
delete(name: string): void;
|
|
set(name: string, value: string): void;
|
|
}
|