Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-17144

ContextPathCompositeHandler returns 200 when no path found

    XMLWordPrintable

    Details

      Description

      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).

        Attachments

          Activity

            People

            Assignee:
            rstoya05-aop Rossen Stoyanchev
            Reporter:
            maubergine Marius Rubin
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              3 years, 29 weeks, 6 days ago