HttpContentDecorator Class

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

Definition

Serves as a base class for decorating HttpContent instances.
public abstract class HttpContentDecorator : HttpContent
Inheritance
Inherited by

Remarks

This class provides common functionality such as copying headers from the original content and managing the lifecycle of the wrapped content.

Constructors

HttpContentDecorator(HttpContent)

Initializes a new instance of the HttpContentDecorator class.
protected HttpContentDecorator(HttpContent content)

Parameters

content HttpContent
The HTTP content to decorate. This content will be disposed when this decorator instance is disposed.

Exceptions

ArgumentNullException
Thrown when content is null.

Properties

OriginalContent

Gets the original HTTP content that this instance decorates.
protected HttpContent OriginalContent { get; }

Property Value

HttpContent
The original HttpContent instance.

Methods

Dispose(bool)

Releases the unmanaged resources used by the HttpContent and optionally disposes of the managed resources.
protected override void Dispose(bool disposing)

Parameters

disposing bool
true to release both managed and unmanaged resources; false to release only unmanaged resources.

Extension Methods

AsDeflate(this HttpContent, CompressionLevel)Compresses the HttpContent using the Deflate compression algorithm.
AsGzip(this HttpContent, CompressionLevel)Compresses the HttpContent using the GZIP compression algorithm.
FindCharacterEncoding(this HttpContent)Attempts to find the character encoding from the HttpContent headers.
IsReusable(this HttpContent)Determines whether the HttpContent instance can be reused.