Documentation
¶
Index ¶
- type CORS
- func (c CORS) AddCORSHeaders(r *http.Request, w http.ResponseWriter)
- func (c CORS) AddCORSHeadersOrigin(origin string, headers http.Header)
- func (c CORS) AddCORSHeadersTo(reqHeaders http.Header, respHeaders http.Header)
- func (c CORS) Handle(w http.ResponseWriter, r *http.Request) bool
- func (c CORS) HandlePreflight(w http.ResponseWriter, r *http.Request)
- func (c CORS) Preflight() http.Handler
- func (c CORS) Wrap(h http.Handler) http.Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CORS ¶
type CORS struct {
CacheDuration time.Duration
Origins []string
RequestHeaders string
ResponseHeaders string
}
CORS handles details for Cross-Origin Resource Sharing. See https://www.w3.org/TR/cors/
func (CORS) AddCORSHeaders ¶
func (c CORS) AddCORSHeaders(r *http.Request, w http.ResponseWriter)
func (CORS) AddCORSHeadersOrigin ¶
func (CORS) AddCORSHeadersTo ¶
func (CORS) Handle ¶
Handle returns true if the request is entirely handled (i.e. is a CORS options request), and false if further handling needs to continue.
func (CORS) HandlePreflight ¶
func (c CORS) HandlePreflight(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.