Skip to content

ContextPathCompositeHandler returns 200 when no path found [SPR-17144] #21681

@spring-projects-issues

Description

@spring-projects-issues

Marius Rubin opened SPR-17144 and commented

In scenarios where a call to a WebFlux application using ContextPathCompositeHandler do not match against a context path then the response can still be status code 200, rather than 404.

It looks like this is because the ContextPathCompositeHandler calls response.setComplete() but returns Mono.empty() when no handlers for a given path have been found.

This results in the callback chain for response.setComplete(), including the commit, and applyStatusCode() invocation to be discarded.

As a result, while the response status has been set to 404, this is not what gets written to outbound buffer.

This project: https://github.com/maubergine/cpch-bug-example illustrates the issue and the effect of updating the code (PR to be raised shortly).


Affects: 5.0.8, 5.1 RC1

Referenced from: pull request #1921

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions