Refit.ISynchronousContentSerializer
An optional capability for an IHttpContentSerializer that can serialize a request body
synchronously (buffered or streamed). Refit uses this when RequestBodySerialization
is Buffered or Streamed,
allowing the System.Text.Json source-generated fast-path to engage. The fast-path runs through the synchronous serialization primitives
(SerializeToUtf8Bytes / Serialize(Utf8JsonWriter, ...)); the built-in SerializeAsync(Stream)
used by JsonContent bypasses it and uses the metadata logic instead.
namespace Refit
{
public interface ISynchronousContentSerializer
{
HttpContent ToHttpContentSynchronous<[Nullable(2)] T>(T item);
HttpContent ToStreamingHttpContent<[Nullable(2)] T>(T item);
}
}