Skip to content

ISynchronousContentSerializer interface

Defined in

Namespace: Refit Assembly: Refit.dll Full name: Refit.ISynchronousContentSerializer Modifiers: public abstract

Summary

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.

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481, net471

Methods

NameSummary
ToHttpContentSynchronousSerializes item synchronously into a buffered HttpContent.
ToStreamingHttpContentCreates an HttpContent that serializes item through the synchronous fast-path onto the request stream, flushing...