global.RequestInit
Shapes a fetch request: its method, headers and body, and a signal that cancels it.
Utilização
Measure an operation without relying on wall-clock changes.
Este tipo é usado por 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);Declaração do tipo
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;
}Membros 4
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
method | "POST" | "PUT" | "PATCH" | "GET" | "HEAD" | "DELETE" | "OPTIONS" | Não | — |
headers | HeadersInit | Não | — |
body | BodyInit | Não | A string goes as UTF-8, text/plain;charset=UTF-8 unless a content type
is set; URLSearchParams as a form. |
signal | AbortSignal | Não | — |
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.