MCPcopy Create free account
hub / github.com/brimdata/super / corsMiddleware

Function corsMiddleware

service/middleware.go:33–47  ·  view source on GitHub ↗
(allowedOrigins []string)

Source from the content-addressed store, hash-verified

31}
32
33func corsMiddleware(allowedOrigins []string) mux.MiddlewareFunc {
34 return cors.New(cors.Options{
35 AllowedOrigins: allowedOrigins,
36 AllowedMethods: []string{
37 http.MethodHead,
38 http.MethodGet,
39 http.MethodPost,
40 http.MethodPut,
41 http.MethodPatch,
42 http.MethodDelete,
43 },
44 AllowedHeaders: []string{"Authorization", "Accept", "Content-Type", "X-Requested-With"},
45 AllowCredentials: true,
46 }).Handler
47}
48
49func accessLogMiddleware(logger *zap.Logger) mux.MiddlewareFunc {
50 logger = logger.Named("http.access")

Callers 1

NewCoreFunction · 0.85

Calls 1

NewMethod · 0.80

Tested by

no test coverage detected