app/Http/Middleware/Cors.js
/**
   * @description middleware handler to allow/disallow preflight requests
   * based upon defined configuration for cors.
   * @method handle
   * @param  {Object}   request
   * @param  {Object}   response
   * @param  {Function} next
   * @return {void}
   * @public
   */
@description middleware handler to allow/disallow preflight requests
based upon defined configuration for cors.
@description middleware handler to allow / disallow preflight requests based upon defined configuration for cors .
* handle (request, response, next) {
    response.header('Access-Control-Allow-Origin', this._getOrigin(request.header('origin')))
    response.header('Access-Control-Allow-Methods', this.methods)
    response.header('Access-Control-Allow-Credentials', this.credentials)
    const corsHeaders = this._getHeaders(request.header('Access-Control-Request-Headers'))
    if (corsHeaders) {
      response.header('Access-Control-Allow-Headers', corsHeaders)
    }
    if (this.exposeHeaders) {
      response.header('Access-Control-Expose-Headers', this.exposeHeaders)
    }
    if (this.maxAge) {
      response.header('Access-Control-Allow-Max-Age', this.maxAge)
    }
    if (request.method() === 'OPTIONS') {
      response.status(204).send()
      return
    }
    yield next
  }
* handle ( request , response , next ) { response . header ( 'Access-Control-Allow-Origin' , this . _getOrigin ( request . header ( 'origin' ) ) ) response . header ( 'Access-Control-Allow-Methods' , this . methods ) response . header ( 'Access-Control-Allow-Credentials' , this . credentials ) const corsHeaders = this . _getHeaders ( request . header ( 'Access-Control-Request-Headers' ) ) if ( corsHeaders ) { response . header ( 'Access-Control-Allow-Headers' , corsHeaders ) } if ( this . exposeHeaders ) { response . header ( 'Access-Control-Expose-Headers' , this . exposeHeaders ) } if ( this . maxAge ) { response . header ( 'Access-Control-Allow-Max-Age' , this . maxAge ) } if ( request . method ( ) === 'OPTIONS' ) { response . status ( 204 ) . send ( ) return } yield next }
@description middleware handler to allow/disallow preflight requests
 based upon defined configuration for cors.
@description middleware handler to allow / disallow preflight requests based upon defined configuration for cors .
/**
     * required headers to be defined on every request
     */ /**
     * setting up cors headers only if they are not set to false.
     */ /**
     * setting up exposed headers if defined
     */ /**
     * setting up max age if defined
     */ /**
     * if request is for OPTIONS send 204 otherwise yield it to
     * next middleware
     */