From 306f942d008b43e828755ac84e3616d8f846ee43 Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Sun, 31 May 2026 18:48:53 +0100 Subject: [PATCH] feat(mw): add dev-mode rate limiting bypass Add build tag split: real rate limiter under !dev, no-op under dev build tag. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- backend/mw/ratelimit.go | 3 +++ backend/mw/ratelimit_dev.go | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 backend/mw/ratelimit_dev.go diff --git a/backend/mw/ratelimit.go b/backend/mw/ratelimit.go index f218e16..99ecd26 100644 --- a/backend/mw/ratelimit.go +++ b/backend/mw/ratelimit.go @@ -1,3 +1,6 @@ +//go:build !dev +// +build !dev + package mw import ( diff --git a/backend/mw/ratelimit_dev.go b/backend/mw/ratelimit_dev.go new file mode 100644 index 0000000..48417b4 --- /dev/null +++ b/backend/mw/ratelimit_dev.go @@ -0,0 +1,17 @@ +//go:build dev +// +build dev + +package mw + +import ( + "net/http" + "time" +) + +func RateLimit(limit int, window time.Duration) func(http.Handler) http.Handler { + return func(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + next.ServeHTTP(w, r) + }) + } +}