Cors class

Middleware for handling Cross-Origin Resource Sharing (CORS).

Constructors

Cors({String origin = '*', String methods = 'GET, POST, PUT, DELETE, PATCH, OPTIONS', String headers = 'Origin, Content-Type, Accept, Authorization'})
Creates a new Cors instance with the specified configuration.

Properties

hashCode int
The hash code for this object.
no setterinherited
headers String
The allowed HTTP headers.
final
methods String
The allowed HTTP methods.
final
origin String
The allowed origin. Defaults to *.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

handle() Middleware
Returns a Middleware that injects CORS headers into the response.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited