remix/headers/raw-headers · Function

View Source

parse

Summary

Parses a raw HTTP header string into a Headers object.

Signature

function parse(raw: string): Headers

Example

let headers = parse('Content-Type: text/html\r\nCache-Control: no-cache')
headers.get('Content-Type') // 'text/html'
headers.get('Cache-Control') // 'no-cache'

Parameters

raw

A raw HTTP header string with headers separated by CRLF (\r\n)

Returns

A Headers object containing the parsed headers