Skip to Content
Drash v3 is in beta. APIs may change.
ReferenceCoreHTTPHeader

Header

Header names used by Drash’s own middleware, as string constants.

import { Header } from "@drashland/drash/core/http/Header.js"; response.headers.set(Header.ContentType, "application/json");

Values

KeyValue
AccessControlAllowCredentialsAccess-Control-Allow-Credentials
AccessControlAllowHeadersAccess-Control-Allow-Headers
AccessControlAllowMethodsAccess-Control-Allow-Methods
AccessControlAllowOriginAccess-Control-Allow-Origin
AccessControlExposeHeadersAccess-Control-Expose-Headers
AccessControlMaxAgeAccess-Control-Max-Age
AccessControlRequestHeadersAccess-Control-Request-Headers
AccessControlRequestMethodAccess-Control-Request-Method
ContentLengthContent-Length
ContentTypeContent-Type
DateDate
ETagETag
IfMatchIf-Match
IfNoneMatchIf-None-Match
LastModifiedLast-Modified
RetryAfterRetry-After
VaryVary

Type

Header is declared as const, so the companion type is a union of the values rather than string:

import type { Header } from "@drashland/drash/core/types/Header.js"; // "Access-Control-Allow-Credentials" | "Content-Type" | ...

The const and the type share a name and live at different paths. Import the type with import type from core/types/Header.js, and the const from core/http/Header.js.

Notes

This list is not exhaustive and is not meant to be. It covers the headers the pre-built middleware read and write — CORS, ETag, and RateLimiter. Any other header name is a plain string.

Last updated on