MCPcopy Create free account
hub / github.com/driangle/taskmd / corsMiddleware

Function corsMiddleware

apps/cli/internal/web/server.go:240–253  ·  view source on GitHub ↗
(next http.Handler)

Source from the content-addressed store, hash-verified

238}
239
240func corsMiddleware(next http.Handler) http.Handler {
241 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
242 w.Header().Set("Access-Control-Allow-Origin", "http://localhost:5173")
243 w.Header().Set("Access-Control-Allow-Methods", "GET, PUT, OPTIONS")
244 w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
245
246 if r.Method == http.MethodOptions {
247 w.WriteHeader(http.StatusNoContent)
248 return
249 }
250
251 next.ServeHTTP(w, r)
252 })
253}

Callers 3

StartMethod · 0.85

Calls 1

ServeHTTPMethod · 0.80

Tested by 2