Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/fathym_common/src/common/http/establishHeaders.ts>establishHeaders

The Fathym Reference Architecture provides the common foundation for applications built in Typescript.
Latest
function establishHeaders
import { establishHeaders } from "https://deno.land/x/fathym_common@v0.2.160/src/common/http/establishHeaders.ts";

Establishes headers for an HTTP request, combining existing headers with new.

Examples

From direct import import { establishHeaders } from "@fathym/common/http";

const headers = establishHeaders(req.headers, { 'Content-Type': 'application/json' });

From common import import { establishHeaders } from "@fathym/common";

const headers = establishHeaders(req.headers, { 'Content-Type': 'application/json' });

Parameters

headers: Headers

The existing headers to be combined.

headersInit: Record<string, string>

The new headers to be added.

Returns

A new Headers object with the combined headers.