Skip to content

split out httpserver.middleware into a new sub-package, with improved API #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jun 4, 2025

Conversation

robbyt
Copy link
Owner

@robbyt robbyt commented Jun 2, 2025

This is a slight breaking change to the httpserver if you used the middleware system. It changes from the previous function wrappers to a handler chain, which is a pattern inspired by Gin. This makes it easier to implement external middleware packages.

All middleware now shares the httpserver.HandlerFunc signature and uses a RequestProcessor for request flow control. Existing middleware (logger, recovery, metrics, state, wildcard) have been updated.

The Route struct now stores handler chains instead of wrapped functions, and route creation uses NewRouteFromHandlerFunc as the primary constructor.

Copy link

github-actions bot commented Jun 2, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@robbyt robbyt force-pushed the rterhaar/middleware-simplify branch from 61254b6 to 2ab92c5 Compare June 4, 2025 00:45
@robbyt robbyt force-pushed the rterhaar/middleware-simplify branch from 26e808f to 81cec02 Compare June 4, 2025 20:13
Copy link

sonarqubecloud bot commented Jun 4, 2025

@robbyt robbyt merged commit 4df95b8 into main Jun 4, 2025
5 checks passed
@robbyt robbyt deleted the rterhaar/middleware-simplify branch June 4, 2025 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant