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

jeffotoni / quick / 253
51%

Build:
DEFAULT BRANCH: main
Ran 15 Mar 2025 12:46PM UTC
Jobs 1
Files 109
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

15 Mar 2025 12:43PM UTC coverage: 53.981% (+0.04%) from 53.941%
253

push

circleci

jeffotoni
Implemented a new Rate Limiter middleware compatible with Quick’s
func(http.Handler) http.Handler pattern.
	•	Resolved the issue of ephemeral ports by ensuring the
KeyGenerator function returns a consistent key (either a fixed test key
or just the IP, excluding the port).
	•	Improved the internal logic to store and increment
request counters (using shards to minimize lock contention).
	•	Added a background cleanup process to remove expired
clients and free memory.
	•	Thoroughly tested with httptest.NewServer and verified
that the 4th request correctly returns HTTP 429 Too Many Requests.
	•	Documented the code with inline comments, including
details on configuration, expiration logic, and concurrency handling.

Added ratelimit middleware with Config struct (Max, Expiration,
KeyGenerator, LimitReached)
- Introduced `quick.App` alias for consistency with frameworks like
  Fiber
- Created `quick.HandlerFunc` to adapt Quick handlers to HTTP handlers
- Added `quick.MiddlewareFunc` for structured middleware handling
- Improved `quick.Ctx` with helper methods: GetHeader, GetHeaders,
  RemoteIP, Method, Path, QueryParam
- Implemented unit tests for Ctx functionsq := quick.New()

	q.Use(limiter.New(limiter.Config{
		Max:        100,
		Expiration: 1 * time.Second,
		KeyGenerator: func(c *quick.Ctx) string {
			return c.RemoteIP()
		},
		LimitReached: func(c *quick.Ctx) {
			c.Set("Content-Type", "application/json")
			c.Status(quick.StatusTooManyRequests).String(`{"error":"Too
many requests"}`)
		},
	}))

	q.Get("/", func(c *quick.Ctx) error {
		return c.Status(200).JSON(map[string]string{"msg":
"Hello, Quick!"})
	})

	q.Listen(":8080")

85 of 154 new or added lines in 5 files covered. (55.19%)

2610 of 4835 relevant lines covered (53.98%)

2066.97 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
2
79.13
1.02% ctx.go
15
81.25
middleware/limiter/limiter.go
15
90.5
-2.02% quick.go
17
0.0
example/middleware/limiter/limiter-ex1/main.go
20
0.0
example/get.ctx/main.go
Jobs
ID Job ID Ran Files Coverage
1 253.1 15 Mar 2025 12:46PM UTC 109
53.98
CircleCI Job
Source Files on build 253
  • Tree
  • List 109
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • CircleCI Build #253
  • 20b9211f on github
  • Prev Build on main (#252)
  • Next Build on main (#254)
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