github.com/gogf/gf/v2@v2.7.4/net/ghttp/ghttp_middleware_cors.go (about)

     1  // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the MIT License.
     4  // If a copy of the MIT was not distributed with this file,
     5  // You can obtain one at https://github.com/gogf/gf.
     6  
     7  package ghttp
     8  
     9  // MiddlewareCORS is a middleware handler for CORS with default options.
    10  func MiddlewareCORS(r *Request) {
    11  	r.Response.CORSDefault()
    12  	r.Middleware.Next()
    13  }