-
Notifications
You must be signed in to change notification settings - Fork 38.5k
AbstractJackson2Encoder::getContentLength should not return null for MonoJust/FluxJust publisher [SPR-16892] #21431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Rossen Stoyanchev commented For Jackson we'd have to buffer the serialized content in memory before writing anything out, so the trade-off is between having Content-Length and requiring less memory. For For |
Mirko Adebahr commented
As this would solve our specific issue it would be perfectly sufficient. I just took it for granted that the encoder has to provide the content length thus the issue title. Still, it is possible that the alternative options you mentioned could be valuable for other users - I myself found it difficult to understand why some |
Rossen Stoyanchev commented Ok so just to be clear, if we ensured Content-Length for Mono, that would solve your needs? |
Mirko Adebahr commented Yes, absolutely. |
@rstoyanchev would it be possible to implement similar behavior for MultipartHttpMessageWriter? Similar use-case, breaking compatibility with legacy service when migrating from RestTemplate to WebClient. It seems like the receiving legacy service is running on top of PHP and FastCGI and has this problem https://bugs.php.net/bug.php?id=60826. |
Uh oh!
There was an error while loading. Please reload this page.
Mirko Adebahr opened SPR-16892 and commented
We're trying to use
WebClient
for creating a non-blocking POST request. The request results in a 400 Bad Request due to a missingcontent-length
header. As the requested endpoint belongs to a 3rd party application, we cannot change that server's behaviour.In #21085, the
EncoderHttpMessageWriter
was enhanced to automatically set thecontent-length
Header if the provided publisher is aMono
. Unfortunately, this does not help when usingJackson2JsonEncoder
for encoding asgetContentLength
will always returnnull
.In my understanding, for
MonoJust
s andFluxJust
s it should be possible to determine the content length and set the header value accordingly.Affects: 5.0.6
Issue Links:
Referenced from: commits 0103521, 4a26f93, 7bfd683, d1c9401
The text was updated successfully, but these errors were encountered: