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

Improve status code handling on WebFlux router predicates

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.1.3
    • Fix Version/s: 5.x Backlog
    • Component/s: Reactive, Web
    • Labels:
    • Last commented by a User:
      true

      Description

      The request predicates were designed to return a boolean to match the request, so the WebFlux router engine always returns the same status code (404) when the predicate returns false.

      The problem is that some predicates need custom responses, for example:

      RequestPredicates.accept() should return 406 (Not Acceptable)
      RequestPredicates.contentType() should return 415 (Unsupported Media Type)
      RequestPredicates.GET() or POST() or any other method should return 405 (Method Not Allowed)
      

      My suggestion is to redesign the RequestPredicate to be able to return customized responses to properly handle each HTTP status code.

      Does it make sense?

        Attachments

          Activity

            People

            Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            rodolphocouto rodolphocouto
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Days since last comment:
              3 years, 24 weeks, 1 day ago