Skip to main content
Deno 2 is finally 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.
Go to Latest
function establishHeaders
import { establishHeaders } from "https://deno.land/x/fathym_common@v0.2.165-integration/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.