mirror of https://github.com/q191201771/lal.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
972 B
Go
30 lines
972 B
Go
// Copyright 2023, Chef. All rights reserved.
|
|
// https://github.com/q191201771/lal
|
|
//
|
|
// Use of this source code is governed by a MIT-style license
|
|
// that can be found in the License file.
|
|
//
|
|
// Author: Chef (191201771@qq.com)
|
|
|
|
package base
|
|
|
|
import "net/http"
|
|
|
|
var (
|
|
CorsHeaders = "Access-Control-Allow-Credentials: true\r\n" +
|
|
"Access-Control-Allow-Origin: *\r\n" +
|
|
"Access-Control-Allow-Headers: Content-Type\r\n"
|
|
)
|
|
|
|
func AddCorsHeaders(w http.ResponseWriter) {
|
|
w.Header().Set("Access-Control-Allow-Credentials", "true")
|
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
|
|
}
|
|
|
|
//resp.Header().Add("Access-Control-Allow-Origin", "*")
|
|
//resp.Header().Add("Access-Control-Allow-Credentials", "true")
|
|
//resp.Header().Add("Access-Control-Allow-Methods", "*")
|
|
//resp.Header().Add("Access-Control-Allow-Headers", "Content-Type,Access-Token")
|
|
//resp.Header().Add("Access-Control-Allow-Expose-Headers", "*")
|