fix(http): honor [RoutePrefix] when no global prefix is configured#2708
Merged
jeremydmiller merged 1 commit intoJasperFx:mainfrom May 8, 2026
Merged
Conversation
…configured RoutePrefixPolicy.Apply was bailing out before iterating chains when neither GlobalRoutePrefix nor any NamespacePrefixes was set, which meant per-handler [RoutePrefix] attributes were silently ignored. The bug only became visible once API Versioning landed: the version-segment policy still ran and produced routes like /v1/create instead of /v1/items/create. Closes JasperFx#2705
Member
|
@outofrange-consulting Thank you! |
This was referenced May 10, 2026
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.
Fixes #2705.
RoutePrefixPolicy.Applyhad an early-exit that skipped iterating chains whenever there was noGlobalRoutePrefixand noNamespacePrefixes. That short-circuit also bypassed the per-handler[RoutePrefix]attribute, so a class-level prefix declared on its own was silently dropped.You normally wouldn't notice — the route just ended up missing one segment. API Versioning made it obvious because the version-segment policy still ran and produced things like
/v1/createinstead of/v1/items/createfor:The fix is just to drop the early-exit.
DeterminePrefixalready returnsnullwhen nothing applies, so the loop is a no-op for chains without any prefix.Tests
apply_honors_attribute_prefix_when_no_global_or_namespace_prefix_configured— unit test for theApplypath that wasn't covered before (existing tests only exercisedDeterminePrefixin isolation, which never tripped the bug).gh_2705_attribute_prefix_combines_with_api_versioning— exact reproduction from the issue:[RoutePrefix("items")]+[WolverinePost("/create")]+ versioning withDefaultVersion = ApiVersion(1)andUnversionedPolicy.AssignDefault. Asserts the final route is/v1/items/create.Verified red → green by stashing the fix (test fails with
/v1/create) and restoring it.