• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

m-lab / locate / 21163548148

20 Jan 2026 07:49AM UTC coverage: 82.233% (-0.7%) from 82.926%
21163548148

push

github

web-flow
feat(priority): implement tier-based rate limiting for /v2/priority/nearest (#238)

* feat: add "locate" as a valid x-google-audiences.

* feat(priority): implement tier-based rate limiting for /v2/priority/nearest

Extract tier from JWT claims and apply per-org rate limits from config.yaml.

* test(handler): add PriorityNearest handler tests

* fix(handler): use getRemoteAddr for correct IP extraction in PriorityNearest

* refactor(handler): introduce TierLimiter interface for tier-based rate limiting

* fix(handler): use int_id claim and default to tier 0 for integration JWTs

* fix(handler): return 401 for invalid credentials instead of fallback to Nearest

* fix(handler): use appropriate log levels to prevent log spam

* fix: resolve golangci-lint errors

- Check req.ParseForm() return value in PriorityNearest
- Rename prom parameter to promClient to avoid import shadow
- Use http.NoBody instead of nil in test request
- Check conn.Send return values in IsLimitedWithTier

* refactor(handler): embed Limiter in TierLimiter for compile-time safety

* fix: remove unused func ParseConfig

* test(limits): add tests for ParseFullConfig error paths

Cover YAML decode errors and invalid tier interval parsing.

* for range 3

* xxx

* x

* ValueOrPanic

* add comment

* docs(limits): add sliding window algorithm explanation

* s/&result/result/

* fix: handle ParseForm() errors

* fix: handle ParseForm errors in Nearest() too

* Remove duplicate NewClientDirect

* update comment

* Fix handler test

* remove unnecessary test

* fix: add correct security settings for JWT to openapi.yaml

139 of 188 new or added lines in 5 files covered. (73.94%)

2379 of 2893 relevant lines covered (82.23%)

6.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.2
/handler/handler.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc