Closed Dreamescaper closed 10 months ago
I was able to workaround it by adding the following line to my setup code:
var defaultSettings = (FlurlHttpSettings)typeof(FlurlHttpSettings).GetField("Defaults", BindingFlags.NonPublic | BindingFlags.Static)!.GetValue(null)!;
defaultSettings.JsonSerializer = new NewtonsoftJsonSerializer();
But that doesn't look like an expected solution.
Yep, this is a pretty blatant bug. Thanks for the details, but it's actually a duplicate of #783 which I'm working on now.
Fixed in the latest release. (See #783.) Thanks again for providing details, it was helpful.
I'm using clientless pattern, and I plan to use Newtonsoft.Json as for now. Unfortunately, I cannot find a way to use Newtonsoft serializer for clientless pattern by default.
I use the following code to set the defaults:
But it is not used by default, the code below still uses DefaultJsonSerializer.
Seems like the problem is that the client from FlurlHttp.Clients is assigned to FlurlRequest instance after the body is serialized - and therefore NewtonsoftSerializer is not used.
I assume it also affects any other Serializer customizations.