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
- object
- HttpContent
- HttpContentDecorator
- 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
contentHttpContent- The HTTP content to decorate. This content will be disposed when this decorator instance is disposed.
Exceptions
- ArgumentNullException
- Thrown when
contentisnull.
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
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. |
