Add option to customize the Gorilla Mux route#810
Merged
Conversation
Contributor
Author
|
my usecase is using |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds an option to customize the Gorilla mux route by introducing a new Option type and a WithRouteCustomizer function.
- Introduces WithRouteCustomizer in options.go for customizing routes.
- Embeds the options into the gMux struct in humamux.go and applies the route customizer in the Handle method.
- Adds tests in humagmux_test.go to verify middleware customization.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| adapters/humamux/options.go | Adds an Option type and WithRouteCustomizer for route customization. |
| adapters/humamux/humamux.go | Updates the gMux struct to embed options and apply route customization in Handle. |
| adapters/humamux/humagmux_test.go | Provides tests validating the custom middleware functionality. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #810 +/- ##
=======================================
Coverage 93.08% 93.08%
=======================================
Files 23 23
Lines 5307 5307
=======================================
Hits 4940 4940
Misses 314 314
Partials 53 53 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This MR adds an option to the Gorilla mux adapter, allowing customizing the mux route.
This allows, for example, adding standard HTTP handlers per route, maybe using
huma.Operation.Metadataas input parameters.