package cors
import "github.com/google/martian/v3/cors"
Package cors provides CORS support for http.Handlers.
Index ¶
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.
func (*Handler) SetOrigin ¶
SetOrigin sets the origin(s) to allow when requested with CORS.
Source Files ¶
- Version
- v3.3.3 (latest)
- Published
- Aug 16, 2022
- Platform
- js/wasm
- Imports
- 1 packages
- Last checked
- 6 hours ago –
Tools for package owners.