Make REST router more like a map and allow overwriting routes#2403
Merged
stephenberry merged 1 commit intomainfrom Mar 26, 2026
Merged
Make REST router more like a map and allow overwriting routes#2403stephenberry merged 1 commit intomainfrom
stephenberry merged 1 commit intomainfrom
Conversation
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.
Fix route conflict error on REST service composition (#2401)
Registering multiple services on a single
glz::registry<opts, REST>via separateon()calls produced spurious "Route conflict" errors on stderr. Each service tried to register GET/PUT handlers at the root path, and the HTTP router threw on duplicates.Changes
include/glaze/net/http_router.hpp— Allow route replacement (last writer wins) instead of throwing on duplicate method+path registrations. This applies to both direct routes and parameterized radix tree routes, making the router consistent with the map-based storage used by REPE and JSONRPC protocols.tests/.../http_router_test.cpp— Added tests for route replacement behavior and a service composition test reproducing the exact scenario from the issue (three services on one registry).docs/— Updated REST, JSONRPC, and REPE registry docs to document service composition behavior: all member endpoints are registered, the root endpoint reflects the last registered service, andglz::mergeis recommended for a combined root view.