MCPcopy Index your code
hub / github.com/coder/coder / RequireExperimentWithDevBypass

Function RequireExperimentWithDevBypass

coderd/httpmw/experiments.go:50–61  ·  view source on GitHub ↗

RequireExperimentWithDevBypass checks if ALL the given experiments are enabled, but bypasses the check in development mode (buildinfo.IsDev()).

(experiments codersdk.Experiments, requiredExperiments ...codersdk.Experiment)

Source from the content-addressed store, hash-verified

48// RequireExperimentWithDevBypass checks if ALL the given experiments are enabled,
49// but bypasses the check in development mode (buildinfo.IsDev()).
50func RequireExperimentWithDevBypass(experiments codersdk.Experiments, requiredExperiments ...codersdk.Experiment) func(next http.Handler) http.Handler {
51 return func(next http.Handler) http.Handler {
52 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
53 if buildinfo.IsDev() {
54 next.ServeHTTP(w, r)
55 return
56 }
57
58 RequireExperiment(experiments, requiredExperiments...)(next).ServeHTTP(w, r)
59 })
60 }
61}

Callers

nothing calls this directly

Calls 3

IsDevFunction · 0.92
RequireExperimentFunction · 0.85
ServeHTTPMethod · 0.45

Tested by

no test coverage detected