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

AbstractJackson2Encoder::getContentLength should not return null for MonoJust/FluxJust publisher

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 5.0.6
    • Fix Version/s: 5.0.7, 5.1 RC1
    • Component/s: Web:Client
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      We're trying to use WebClient for creating a non-blocking POST request. The request results in a 400 Bad Request due to a missing content-length header. As the requested endpoint belongs to a 3rd party application, we cannot change that server's behaviour.

      In SPR-16542, the EncoderHttpMessageWriter was enhanced to automatically set the content-length Header if the provided publisher is a Mono. Unfortunately, this does not help when using Jackson2JsonEncoder for encoding as getContentLength will always return null.

      In my understanding, for {{MonoJust}}s and {{FluxJust}}s it should be possible to determine the content length and set the header value accordingly.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rstoya05-aop Rossen Stoyanchev
                Reporter:
                mirko.adebahr Mirko Adebahr
                Last updater:
                Juergen Hoeller
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  19 weeks ago