Describe the bug
When a request is serialized using SystemTextJsonContentSerializer, the request payload looks incomplete.
Steps To Reproduce
Send a request to a service using a payload with byte array and some other attributes (sorry, I can't attach a reproducible sample).
!! Instead, using NewtonsoftJsonContentSerializer the problem is not reproducible and everything works like expected.
Expected behavior
I expect that my request is being serialized in the right way without any data loss.
Environment
I'm seeing this issue as well now. Sending a request containing a byte array, and the receiving side waits for data it never receives. Reading a single byte at the time from the incoming stream, its within the base64 encoded byte[] array.
We need a repro (failing test ideally) to figure out what's going on.... so far, all tests are passing and System.Text.Json is set to be the default in #1005
What does the object with the byte array / request look like so we can try to repro?
Created a test project outside refit source, since I was not able to create a failing test within the existing refit tests framework. You probably know how.. :-)
https://github.com/cocytus/RfTest -> This fails when the size of the array reaches 61400
GitHub
GitHub is where people build software. More than 50 million people use GitHub to discover, fork, and contribute to over 100 million projects.
I just got to test this using a locally compiled refit, by copying the refit stubs generator compile target from Refit.Tests.csproj. With the main branch checked out, the error does not occur. If i check out the commit tagged 5.2.1, it does occur. So it's fixed... whatever it was.
As is visible from PR, it seems like it was not actually fixed, just not visible, but for some users it might very well be.
This is fixed in version 5.2.4 (and 6.0-preview), just published to NuGet. Thank you @cocytus for the repro and patch!