Default header fields middleware.
Injects static or dynamically supplied default header fields into every request routed through the wrapped Fetch implementation, leaving fields already carried by the request as they are.
Usage
import { createFetch } from "@metreeca/http";import { headers } from "@metreeca/http/headers";const client = createFetch(headers({ "Accept": "application/json" })); Copy
import { createFetch } from "@metreeca/http";import { headers } from "@metreeca/http/headers";const client = createFetch(headers({ "Accept": "application/json" }));
RFC 9110 § 5 - Fields
Creates a middleware injecting default header fields into requests.
Default header fields middleware.
Injects static or dynamically supplied default header fields into every request routed through the wrapped Fetch implementation, leaving fields already carried by the request as they are.
Usage
See
RFC 9110 § 5 - Fields