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

go-pkgz / routegroup / 16864812405
98%

Build:
DEFAULT BRANCH: master
Ran 10 Aug 2025 06:12PM UTC
Jobs 1
Files 1
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

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

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

New Missed Lines in Diff

Lines Coverage ∆ File
1
97.79
1.81% group.go

Uncovered Existing Lines

Lines Coverage ∆ File
1
97.79
1.81% group.go
Jobs
ID Job ID Ran Files Coverage
1 16864812405.1 10 Aug 2025 06:12PM UTC 1
97.79
GitHub Action Run
Source Files on build 16864812405
  • Tree
  • List 1
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 74f1c516 on github
  • Prev Build on master (#16852076434)
  • Next Build on master (#16865400344)
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