<PackageReference Include="Refit" Version="15.0.0" />

Refit.RequestBodySerializationMode

Controls how Refit serializes JSON request bodies.

The body is serialized synchronously into a buffer and sent as a ByteArrayContent. This lets the source-generated fast-path engage (with fast-path-eligible options) and sets a Content-Length header. Best for small-to-medium bodies. Requires an ISynchronousContentSerializer.

Default = 0

The default: the body is serialized asynchronously (via JsonContent). This uses the metadata-based System.Text.Json logic, never the source-generated fast-path.

The body is serialized through a Utf8JsonWriter written to the request stream and flushed asynchronously. This keeps the source-generated fast-path while bounding peak memory (the writer buffers in pooled chunks rather than materializing the whole body), at the cost of a Content-Length header. Best for large uploads. Requires an ISynchronousContentSerializer.