Return not found for unresolved function routes - #4274
Open
avsan wants to merge 1 commit into
Open
Conversation
Avoid invoking the Spring Cloud Function routing function when an unmatched Gateway function route has no routing target, default route handler, or routing callback. This prevents unmatched requests from failing during request body conversion and returns 404 Not Found instead, while preserving default function routing behavior. Add regression coverage for unmatched routes and automatic function routing. See spring-cloudgh-4170 Signed-off-by: Abhishek Kumar Pandey <abhishekrajabca@gmail.com>
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.
Summary
Return
404 Not Foundwhen a default WebMVC function route cannot resolve a target function.Previously, an unmatched request could fall through to Spring Cloud Function's
RoutingFunctionand fail during request processing, resulting in415 Unsupported Media Typeinstead of the expected404 Not Found.The change preserves the existing
RoutingFunctionfallback when a routing target, default route handler, orMessageRoutingCallbackis available.Changes
404 Not Foundwhen no function routing target can be resolved.RoutingFunctionfallback behavior.Testing
Before the fix:
GET /does-not-existExpected:
404 NOT_FOUNDActual:
415 UNSUPPORTED_MEDIA_TYPEAfter the fix:
GET /does-not-exist→404 NOT_FOUNDValidation completed:
FunctionHandlerConfigTests: 5 tests passed.DefaultRouteFunctionHandlerTests: 5 tests passed.git diff --check: clean.A later full Maven reactor validation attempt was blocked before compilation because the upstream
spring-cloud-stream-dependencies:5.1.0-SNAPSHOTBOM could not be resolved from the Spring snapshot repository.Fixes #4170