EmptyContent Class

Namespace
Kampute.HttpClient.Content
Assembly
  • Kampute.HttpClient.dll

Definition

Represents content with no body, whose length is zero.
public sealed class EmptyContent : HttpContent
Inheritance

Remarks

Use it to send a request that needs content, such as one with Content-* headers, but no body.

Methods

SerializeToStreamAsync(Stream, TransportContext)

Writes nothing to the stream.
protected override Task SerializeToStreamAsync(Stream stream, TransportContext context)

Parameters

stream Stream
The stream to write to.
context TransportContext
The transport context.

Returns

Task
A task that represents the asynchronous operation.

TryComputeLength(out long)

Returns the length of the content, which is zero.
protected override bool TryComputeLength(out long length)

Parameters

length long
Always 0.

Returns

bool
Always true.

Extension Methods

AsDeflate(this HttpContent, CompressionLevel)Wraps the content in content that compresses it with Deflate as it is sent.
AsGzip(this HttpContent, CompressionLevel)Wraps the content in content that compresses it with GZip as it is sent.
FindCharacterEncoding(this HttpContent)Returns the character encoding named by the charset parameter of the Content-Type header.
IsReusable(this HttpContent)Determines whether the content can be sent more than once, as a retry requires.