import { type CorsOptions } from "https://deno.land/x/fast@4.0.0-alpha.2/middleware/mod.ts";
An Object will all possible options that can be passed to cors
.
The default options are:
{
origin: '*',
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
preflightContinue: false,
optionsSuccessStatus: 204,
}
Properties
The value to match against the Access-Control-Allow-Origin
header in the requestuest. Defaults to '*'
.
It can be a boolean, string, a regular expression, an array of those, or a function that returns one of those.
If set to '*'
all origins will be allowed.
If set to true
then Access-Control-Allow-Origin
will
reflect the origin of the requestuest.
If set to false
then all origins will be denied (Access-Control-Allow-Origin
will not be set).
If set to a regular expression then the requestuest origin will be matched against it.
If set to a function, it will receive the requestuest origin string as the first parameter and the requestuest as the second parameter. It can return a promise.
Customizes the Access-Control-Allow-Methods
header.
It can be a string or an array of strings. Defaults to 'GET,HEAD,PUT,PATCH,POST,DELETE'
.
Configures the Access-Control-Allow-Headers
header.
It can be a string or an array of strings. There's no default value (the header is omitted).
Configures the Access-Control-Expose-Headers
header.
It can be a string or an array of strings. There's no default value (the header is omitted).
Configures the Access-Control-Allow-Credentials
header.
It can be a boolean. But the header is only set if it is true
.
There's no default value (the header is omitted).