Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/drash/src/modules/middleware/CORS/mod.ts>CORSMiddleware

A microframework for building JavaScript HTTP applications. Runtime-agnostic. Strongly typed.
Latest
class CORSMiddleware
extends Middleware
import { CORSMiddleware } from "https://deno.land/x/drash@v3.0.0-beta.2/src/modules/middleware/CORS/mod.ts";

Constructors

new
CORSMiddleware(options?: Options)

Construct the middleware that handles CORS requests.

Methods

protected
appendHeaderValue(header: { key: string; value: string; }, headers: Headers): void
protected
getAllowOriginHeaderValue(request: Request): string | null

All CORS-related response headers start out with the values defined in this method.

protected
setHeaderAllowCredentials(headers: Headers): void
protected
setHeaderAllowHeaders(req: Request, headers: Headers): void
protected
setHeaderAllowMethods(headers: Headers)
protected
setHeaderAllowOrigin(request: Request, headers: Headers): void
protected
setHeaderExposeHeaders(headers: Headers): void
protected
setHeaderMaxAge(headers: Headers)
protected
setPreflightHeaders(request: Request, headers: Headers): void
ALL(request: Request): Promise<Response>