CorsHook class

The CorsHook class is a hook that adds CORS headers to the response.

Inheritance
Mixed-in types

Constructors

CorsHook({List<String> allowedOrigins = const ['*']})
The CorsHook constructor.

Properties

allowedOrigins List<String>
The allowed origins.
final
hashCode int
The hash code for this object.
no setterinherited
responseHeaders Map<String, String>
The response headers.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
service Object?
The Hook can expose a service that will be used by the application without the need to create a new module.
no setterinherited

Methods

beforeHandle(ExecutionContext<ArgumentsHost> context) Future<void>
The beforeHandle method is used to execute code before the request is handled
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onRequest(ExecutionContext<ArgumentsHost> context) Future<void>
The onRequest method is used to execute code before the request is handled
override
onResponse(ExecutionContext<ArgumentsHost> context, WrappedResponse response) Future<void>
The onResponse method is used to execute code before the response is sent
override
toString() String
A string representation of this object.
inherited

Operators

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