parse

View Source

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'

Params

raw

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

Returns

A Headers object containing the parsed headers