global.RequestInit
Shapes a fetch request: its method, headers and body, and a signal that cancels it.
Verwendung
Measure an operation without relying on wall-clock changes.
Dieser Typ wird verwendet von global.fetch
// Measure an operation without relying on wall-clock changes.
const start = performance.now();
const response = await fetch('https://example.com/api/health');
console.log(response.status, performance.now() - start);Typdeklaration
interface RequestInit {
method?: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
headers?: HeadersInit;
/**
* A string goes as UTF-8, `text/plain;charset=UTF-8` unless a content type
* is set; URLSearchParams as a form.
*/
body?: BodyInit | null;
signal?: AbortSignal | null;
}Mitglieder 4
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
method | "POST" | "PUT" | "PATCH" | "GET" | "HEAD" | "DELETE" | "OPTIONS" | Nein | — |
headers | HeadersInit | Nein | — |
body | BodyInit | Nein | A string goes as UTF-8, text/plain;charset=UTF-8 unless a content type
is set; URLSearchParams as a form. |
signal | AbortSignal | Nein | — |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.