private function withHeaders($request)
  {
    $headers = Config::get('cors.allowedHeaders');
    $methods = Config::get('cors.allowedMethods');
    $exposed = Config::get('cors.exposedHeaders');
    $maxAge  = Config::get('cors.maxAge');

    $request->headers->addMany([
      'Access-Control-Allow-Credentials' => Config::get('cors.supportsCredentials'),
      'Access-Control-Allow-Origin' => '*',
      'Access-Control-Allow-Headers' => implode(', ', $headers),
      'Access-Control-Allow-Methods' => implode(', ', $methods),
    ]);

    if (count($exposed) > 0) {
      $request->headers->add('Access-Control-Exposed-Headers', implode(', ', $exposed));
    }

    if ($maxAge > 0) {
      $request->headers->add('Access-Control-Max-Age', $maxAge);
    }
  }
private function withHeaders($request)
  {
    $headers = Config::get('cors.allowedHeaders');
    $methods = Config::get('cors.allowedMethods');
    $exposed = Config::get('cors.exposedHeaders');
    $maxAge  = Config::get('cors.maxAge');

    $request->headers->addMany([
      'Access-Control-Allow-Credentials' => Config::get('cors.supportsCredentials'),
      'Access-Control-Allow-Origin' => '*',
      'Access-Control-Allow-Headers' => implode(', ', $headers),
      'Access-Control-Allow-Methods' => implode(', ', $methods),
    ]);

    if (count($exposed) > 0) {
      $request->headers->add('Access-Control-Exposed-Headers', implode(', ', $exposed));
    }

    if ($maxAge > 0) {
      $request->headers->add('Access-Control-Max-Age', $maxAge);
    }
  }
private function withHeaders ( $ request ) { $ headers = Config :: get ( 'cors.allowedHeaders' ) ; $ methods = Config :: get ( 'cors.allowedMethods' ) ; $ exposed = Config :: get ( 'cors.exposedHeaders' ) ; $ maxAge = Config :: get ( 'cors.maxAge' ) ; $ request -> headers -> addMany ( [ 'Access-Control-Allow-Credentials' => Config :: get ( 'cors.supportsCredentials' ) , 'Access-Control-Allow-Origin' => '*' , 'Access-Control-Allow-Headers' => implode ( ', ' , $ headers ) , 'Access-Control-Allow-Methods' => implode ( ', ' , $ methods ) , ] ) ; if ( count ( $ exposed ) > 0 ) { $ request -> headers -> add ( 'Access-Control-Exposed-Headers' , implode ( ', ' , $ exposed ) ) ; } if ( $ maxAge > 0 ) { $ request -> headers -> add ( 'Access-Control-Max-Age' , $ maxAge ) ; } }
Adds cors headers.

@param  \Modulus\Http\Request $request
@return void
Adds cors headers .