You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1643323
Browse filesBrowse the repository at this point in the historyBrowse files
* feat(body): compress request bodies
- Add `[Body(Compression = ...)]` so a method can send its body under a
content coding. Refit compresses whatever the serializer produced and sets
Content-Encoding, so the coding composes with every serialization method.
- Add RefitSettings.RequestCompression for a client-wide default. A [Body]
parameter naming its own coding overrides it, and None opts one method out.
- Use the framework's GZipCompressedContent, BrotliCompressedContent and
ZstandardCompressedContent on net11.0, and compress through GZipStream or
BrotliStream below it.
- Throw PlatformNotSupportedException for a coding this framework cannot
produce rather than quietly sending the body uncompressed. gzip is always
available, Brotli needs net8.0, Zstandard needs net11.0.
Closes#2307
* feat(body): configure the request compressor directly
- Add RefitSettings.RequestCompressionOptions so a client can set the
compressor's own knobs - window size, strategy, a Zstandard dictionary -
which a CompressionLevel cannot express.
- Options set for a coding replace the level for that coding; the codings
left unset still compress by level.
- The options types arrived with .NET 9.0, and Zstandard's with .NET 11.0,
so the surface only exists from net9.0 onward.
* test(body): cover the request compression paths
- Add generator tests for the coding and level a [Body] parameter declares,
including the None case that emits no call and a level declared without a
coding.
- Add direct tests for the coding-to-token map and for the wrap and the
compressor refusing a value that names no coding.
- Add options tests for Brotli and Zstandard, so every coding that accepts
its own compressor settings is exercised on the targets that have them.
- Read an erroneous named argument through its TypedConstant kind rather
than its value, so a value the compiler already rejected leaves the
defaults in place instead of being read as an int.
/// <summary>Gets or sets how hard <see cref="Compression"/> compresses (defaults to <see cref="System.IO.Compression.CompressionLevel.Optimal"/>).</summary>
66
+
/// <remarks>Read only when <see cref="Compression"/> names a coding; otherwise the settings supply the level too.</remarks>
0 commit comments