CorsMiddleware function

RequestMiddleware CorsMiddleware (
  1. Cors config
)

Implementation

RequestMiddleware CorsMiddleware(Cors config) {
  return (Request req) {
    if (req.method == 'OPTIONS') return handlePreFlight(req, config);

    return handleActualRequest(req, config);
  };
}