Documentation ¶
Overview ¶
Package cors provides CORS support for http.Handlers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is an http.Handler that wraps other http.Handlers and provides CORS support.
func NewHandler ¶
NewHandler wraps an existing http.Handler allowing it to be requested via CORS.
func (*Handler) AllowCredentials ¶
AllowCredentials allows cookies to be read by the CORS request.
func (*Handler) ServeHTTP ¶
func (h *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP determines if a request is a CORS request (normal or preflight) and sets the appropriate Access-Control-Allow-* headers. It will send the request to the underlying handler in all cases, except for a preflight (OPTIONS) request.
Click to show internal directories.
Click to hide internal directories.