CorsMiddleware function

RequestMiddleware CorsMiddleware (
  1. Cors config
)

Implementation

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