Return 404 for mis-cased FHIR resource type segments#5530
Merged
Conversation
…ated queries and enhance capability statement tests for patient resource interactions.
FHIR resource type names are case-sensitive. Previously a request like
GET /patient/{id} would match the route via case-insensitive comparison
in ResourceTypesRouteConstraint, then fail action selection and return
405 Method Not Allowed. Per spec it should be 404 Not Found.
Make ResourceTypesRouteConstraint match resource types case-sensitively
so unknown/mis-cased segments produce a uniform framework 404 across
all verbs (GET/PUT/DELETE/POST). CompartmentResourceTypesRouteConstraint
delegates to the same constraint and inherits the fix.
Adds unit tests covering mis-cased paths and per-verb behavior, plus an
E2E test asserting 404 for lowercase/mixed-case resource type segments.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5530 +/- ##
=======================================
Coverage ? 77.11%
=======================================
Files ? 983
Lines ? 35996
Branches ? 5467
=======================================
Hits ? 27758
Misses ? 6896
Partials ? 1342 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
feordin
reviewed
May 5, 2026
feordin
approved these changes
May 15, 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.
Description
This PR fixes two related case-sensitivity bugs surfaced by requests like
GET /patient/{id}(lowercase resource type):Reproduction
Bug 1: mis-cased resource type returns 405
GET https://localhost:44348/patient/123(lowercase) — orPUT,DELETE,POST.Bug 2: lowercase request poisons later correctly-cased requests
DELETE https://localhost:44348/patient/123.DELETE https://localhost:44348/Patient/123.ValidateCapabilityPreProcessorand continues to do so for the lifetime of the process.Related Work Items
AB#190027