setCors method

dynamic setCors({
  1. String Methods = 'GET, POST, PUT, PATCH, DELETE',
  2. int MaxAge = 36000,
  3. String Origins = '*',
})

Implementation

dynamic setCors({String Methods='GET, POST, PUT, PATCH, DELETE', int MaxAge=36000, String Origins='*', }){
  res?.headers.set('Access-Control-Allow-Origin', Origins);
  res?.headers.set('Access-Control-Allow-Methods', Methods);
  res?.headers.set('Access-Control-Allow-Headers', '*');
  res?.headers.set('Access-Control-Max-Age', MaxAge);
}