41 lines
703 B
Go
41 lines
703 B
Go
// Package request_cors ...
|
|
//
|
|
// Description : request_cors ...
|
|
//
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
//
|
|
// Date : 2022-07-13 16:27
|
|
package request_cors
|
|
|
|
import "net/http"
|
|
|
|
type cors struct {
|
|
allowAllOrigins bool
|
|
allowCredentials bool
|
|
allowOriginFunc func(string) bool
|
|
allowOrigins []string
|
|
normalHeaders http.Header
|
|
preflightHeaders http.Header
|
|
wildcardOrigins [][]string
|
|
}
|
|
|
|
var (
|
|
DefaultSchemas = []string{
|
|
"http://",
|
|
"https://",
|
|
}
|
|
ExtensionSchemas = []string{
|
|
"chrome-extension://",
|
|
"safari-extension://",
|
|
"moz-extension://",
|
|
"ms-browser-extension://",
|
|
}
|
|
FileSchemas = []string{
|
|
"file://",
|
|
}
|
|
WebSocketSchemas = []string{
|
|
"ws://",
|
|
"wss://",
|
|
}
|
|
)
|