Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Class

HttpStringContent

class HttpStringContent

Module: System.Web.Http
Assembly: System.Web.dll
Source file: HttpContentTypes.rvn

Inheritance: Object → HttpContent → HttpStringContent

Buffered UTF-8 text content, using text/plain by default.

Remarks

Encoding is currently eager. Reading incoming text remains a separate consumer operation; this type does not imply that arbitrary received content is text.

Constructors

3 items
HttpStringContent(text: string, contentType: MediaType) Encodes UTF-8 text with a validated Content-Type.
HttpStringContent(text: string, contentType: string) Encodes text as UTF-8 with an explicit outbound Content-Type.
HttpStringContent(text: string) Encodes text as UTF-8 with text/plain; charset=utf-8.

Properties

2 items
IsBuffered: bool True when content already has a complete byte sequence. Inherited from HttpContent.IsBuffered
Length: int Declared byte count, or -1 for incoming chunked/close-delimited content. Inherited from HttpContent.Length

Methods

9 items
CopyTo(destination: OutputStream, cancellationToken?: CancellationToken) -> Task<Result<void, HttpError>> Copies buffered or streaming content with bounded staging and backpressure. Inherited from HttpContent.CopyTo
Dispose() -> () Releases owned stream content; borrowed sources remain open. Idempotent. Inherited from HttpContent.Dispose · Implements Disposable.Dispose
Equals(other: object?) -> bool Tests reference identity by default; an ordinary class may override equality. Inherited from Object.Equals
GetContentType() -> Result<Optional<MediaType>, HttpError> Parses this producer's declared Content-Type without consuming its body. Inherited from HttpContent.GetContentType
GetHashCode() -> int Returns a stable identity hash by default; an ordinary class may override it consistently with equality. Inherited from Object.GetHashCode
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
Static member: Read(content: HttpContent) -> Task<Result<string, HttpError>> Reads a buffered or streaming body as strict UTF-8 text.
ToString() -> string Returns the concrete runtime type name for supported references, or display text from a class or boxed-struct override. Inherited from Object.ToString
TryGetStream() -> Optional<InputStream> Returns the one-shot input stream, or None for buffered content. Does not read. The content owns the stream unless HttpStreamContent.Create was passed leaveOpen=true. Inherited from HttpContent.TryGetStream