function printHeaders
printHeaders(
headers: ReadonlyMap<string, string>,
_palette: Theme
): string

A block of headers, one per line, with the names in the colour that means "this is what you came to find".

Sorted, because a header block is looked THROUGH rather than read, and the order a server happened to send them in helps nobody find content-type.

import { printHeaders } from './print-request.ts';

const plain = { painter: () => (text: string) => text };
printHeaders(new Map([['b', '2'], ['a', '1']]), plain); // 'a: 1\nb: 2' — painted where colour is on
printHeaders(new Map(), plain); // '' — nothing to print, and the caller says so in words

Parameters

headers: ReadonlyMap<string, string>
_palette: Theme

Return Type

string

Usage

import { printHeaders } from "lib/commands/repl/print-request.ts";