Normalize The HTTP Method When Building The Route Table#178
Merged
stevehu merged 1 commit intoJul 21, 2026
Merged
Conversation
The route table was keyed by the raw method from the configuration while lookups used the lower cased request method, so a key written as /v1/pets@GET registered a route that no request could reach. Since #174 that failed as a clean ERR10086 instead of an NPE, which made the misconfiguration silent. Normalize both sides through a single normalizeMethod helper using Locale.ROOT, so an OPTIONS route is not broken by the Turkish dotless i under a non-ROOT default locale. Also split the configuration key on the last '@' rather than every '@', so a path containing the separator still parses, and skip a malformed key with a logged error instead of throwing ArrayIndexOutOfBoundsException during construction. Drop the redundant put; computeIfAbsent already inserts and the matcher is mutated in place. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Base automatically changed from
176-add-regression-test-coverage-for-lambdaproxymiddleware-route-miss
to
master
July 21, 2026 19:11
Contributor
Author
|
The patch consistently normalizes configured and incoming HTTP methods with Locale.ROOT, safely parses endpoint keys using the final separator, and adds targeted regression coverage. No actionable correctness issue was identified. |
stevehu
deleted the
175-http-method-case-mismatch-causes-configured-routes-to-never-match
branch
July 21, 2026 19:16
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 #175.
The bug
The route table was keyed by the raw method from configuration, while lookups used the lower cased request method:
So
/v1/pets@GETregistered a route that no request could ever reach. Before #174 this surfaced as an NPE; since #174 it fails as a cleanERR10086, which is correct handling for a routing miss but makes the misconfiguration silent — the route is simply dead.Changes
normalizeMethodapplied on both registration and lookup, so the two sides cannot drift again.Locale.ROOTrather than the default locale.OPTIONScontains anI, so under a Turkish default localetoLowerCase()yieldsoptıonswith a dotless i and the route breaks. This is why the helper exists rather than just adding.toLowerCase()at the registration site.@instead of every@, so a path containing the separator still parses.ArrayIndexOutOfBoundsExceptionduring construction. A single bad entry taking down every invocation of the proxy seemed the worse failure mode, but say the word if you would rather fail fast at startup.put—computeIfAbsentalready inserts and the matcher is mutated in place.Verification
The five new tests were run against the pre-fix source and all fail with exactly the reported symptoms:
With the fix:
Tests run: 84, Failures: 0, Errors: 0, Skipped: 4— 79 from #177, 5 added.BUILD SUCCESS,git diff --checkclean.Compatibility
Existing all-lowercase configurations are unaffected —
values.ymlin the test resources already uses lowercase, and the full suite passes unchanged. Configurations that currently use upper or mixed case will start routing where they previously returnedERR10086. That is the intent of the fix, but it is a behaviour change worth calling out.🤖 Generated with Claude Code