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
| Key | Value |
|---|---|
AccessControlAllowCredentials | Access-Control-Allow-Credentials |
AccessControlAllowHeaders | Access-Control-Allow-Headers |
AccessControlAllowMethods | Access-Control-Allow-Methods |
AccessControlAllowOrigin | Access-Control-Allow-Origin |
AccessControlExposeHeaders | Access-Control-Expose-Headers |
AccessControlMaxAge | Access-Control-Max-Age |
AccessControlRequestHeaders | Access-Control-Request-Headers |
AccessControlRequestMethod | Access-Control-Request-Method |
ContentLength | Content-Length |
ContentType | Content-Type |
Date | Date |
ETag | ETag |
IfMatch | If-Match |
IfNoneMatch | If-None-Match |
LastModified | Last-Modified |
RetryAfter | Retry-After |
Vary | Vary |
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