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

go-pkgz / routegroup
98%
master: 98%

Build:
Build:
LAST BUILD BRANCH: refs/tags/v1.5.3
DEFAULT BRANCH: master
Repo Added 22 Feb 2024 08:55AM UTC
Files 1
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

LAST BUILD ON BRANCH refs/tags/v1.5.2
branch: refs/tags/v1.5.2
CHANGE BRANCH
x
Reset
  • refs/tags/v1.5.2
  • better-root-handling
  • catch-all
  • cleanup
  • custom-not-found
  • feat/handle-root-without-redirect
  • fix-405-response
  • fix-issue-24-double-middleware
  • fix-issue-27-notfound-vs-405
  • fix-path-params-issue-22
  • master
  • mux-compat
  • pr19
  • refs/tags/v0.1.0
  • refs/tags/v0.1.1
  • refs/tags/v0.2.0
  • refs/tags/v0.2.1
  • refs/tags/v0.3.0
  • refs/tags/v0.4.0
  • refs/tags/v0.5.0
  • refs/tags/v1.0.0
  • refs/tags/v1.1.0
  • refs/tags/v1.1.1
  • refs/tags/v1.2.0
  • refs/tags/v1.3.0
  • refs/tags/v1.3.1
  • refs/tags/v1.4.0
  • refs/tags/v1.4.1
  • refs/tags/v1.5.0
  • refs/tags/v1.5.1
  • refs/tags/v1.5.3
  • static-files
  • update-golangci-lint

10 Aug 2025 06:11PM UTC coverage: 97.79% (+1.8%) from 95.977%
16864853501

push

github

web-flow
Fix issue #24: Empty Request.Pattern and double middleware execution (#25)

* Fix double middleware execution and empty Request.Pattern (#24)

This fixes two related issues:
1. Middleware was being called twice on root group with path params
2. Request.Pattern was empty when global middlewares executed

Root cause: middlewares were being applied both at route registration
time (in wrapMiddleware) and at serve time (via wrapGlobal).

The fix:
- Modified wrapMiddleware to skip applying middlewares for root bundle
  routes since they're applied globally in ServeHTTP
- Create a shallow copy of the request with Pattern set before applying
  global middlewares, ensuring middlewares can see the pattern
- Updated minimum Go version to 1.23 (required for setting Request.Pattern)

Added comprehensive tests to verify:
- Middleware is called exactly once
- Request.Pattern is properly set throughout the request lifecycle
- Multiple middlewares all see the correct pattern
- Both routes with and without path parameters work correctly

* Address review feedback: simplify code and fix outdated comment

- Remove outdated comment about disabling root not-found handler
- Simplify wrapMiddleware start-index logic for better readability
  by putting early return first and clarifying the child bundle logic

* Add comprehensive middleware tests

- Test PathValue accessibility in middlewares (documents expected behavior)
- Test middleware abort patterns for auth/security
- Test With() method middleware counting to prevent double execution
- Test response writer interception for logging/metrics
- Test context propagation through middleware chain
- Test middleware request property modifications

These tests ensure critical middleware behaviors are properly covered
to prevent regressions like issue #24.

* Simplify HandleRoot and HandleRootFunc comments

- Remove overly verbose and duplicated documentation
- Keep essential information in concise format
- Improve readability with... (continued)

16 of 17 new or added lines in 1 file covered. (94.12%)

1 existing line in 1 file now uncovered.

177 of 181 relevant lines covered (97.79%)

48.52 hits per line

Relevant lines Covered
Build:
Build:
181 RELEVANT LINES 177 COVERED LINES
48.52 HITS PER LINE
Source Files on refs/tags/v1.5.2
  • List 1
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
16864853501 refs/tags/v1.5.2 Fix issue #24: Empty Request.Pattern and double middleware execution (#25) * Fix double middleware execution and empty Request.Pattern (#24) This fixes two related issues: 1. Middleware was being called twice on root group with path params 2. Re... push 10 Aug 2025 06:16PM UTC web-flow github
97.79
See All Builds (122)
  • Repo on GitHub
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

© 2025 Coveralls, Inc