dynamicCors function
On-the-fly configures the cors handler. Use this when the context of the surrounding request is necessary to decide how to handle an incoming request.
Implementation
Future<bool> Function(RequestContext, ResponseContext) dynamicCors(
FutureOr<CorsOptions> Function(RequestContext, ResponseContext) f) {
return (req, res) async {
var opts = await f(req, res);
var handler = cors(opts);
return await handler(req, res);
};
}