2.0.0 • Published 5 years ago
@tshttp/header v2.0.0
@tshttp/header 📰
Ultra typed, over documented, and neatly organised HTTP header enums, to use for a great developper experience.
Get started
yarn add @tshttp/header
npm install @tshttp/headerimport { Header } from '@tshttp/header'
req.header(Header.ContentType)Enums
Header enum is composed of the following exported enums:
RequestHeaderfor the HTTP request headers.ResponseHeaderfor the HTTP response headers.
import { RequestHeader, ResponseHeader } from '@tshttp/header'
req.get(RequestHeader.XForwardedFor)
res.set(ResponseHeader.Allow, 'GET')These enums are actually object litterals with a const assertion.`
Unions
When use as a type, each category is a union of corresponding headers.
import { Header, ResponseHeader } from '@tshttp/status'
function setHeader(name: ResponseHeader, value: string) {
//...
}