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

API Browser

Class

HttpResponse

class HttpResponse

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

Inheritance: Object → HttpResponse
Implements: Disposable

A disposable response with status, headers and buffered or streaming content; Respond configures status/content without I/O. Public construction supports fake/custom handlers.

Remarks

Development after Preview 9. Expected HTTP failures use the HttpError union, preserving DNS and socket causes. The socket transport admits HTTP/1.1 final statuses 200–599 using Content-Length, bounded chunked or close-delimited framing; HEAD/204/304 complete after headers, at most 32,768 header bytes, 100 fields and 1,048,576 body bytes. Chunk metadata is limited to 65,536 bytes; extensions and trailers are unsupported. HTTPS requires explicit SslClientAuthenticationOptions through HttpSocketHandler. No pooling, redirects or unknown-length uploads. Bounded informational responses are supported. ResponseHeadersRead transfers a one-shot body stream after final headers. Known-length stream uploads, buffered bodies and decoded incoming streams are limited to 1,048,576 bytes. HttpClient.Timeout covers the complete handler pipeline through the selected response completion point and defaults to 100 seconds. None disables the client countdown. DNS, connect and transfers retain independent five-second phase bounds, so transport failures can occur earlier. Direct HttpSocketHandler use has no client-wide countdown. Cancellation and expiry require scheduler progress and provider cleanup acknowledgement. See the Web feature guide for contracts and limits.

Constructors

2 items
HttpResponse(statusCode: HttpStatusCode, headers: Sequence<HttpHeader>, content: HttpContent) Creates a response retaining its body without reading or copying it. Content metadata replaces any Content-Type header; other headers are preserved.
HttpResponse(statusCode: int, headers: Sequence<HttpHeader>, content: HttpContent) Creates a response from a numeric status and an explicit content producer. The transport validates framing and length before sending.

Properties

7 items
Content: HttpContent The response buffered content.
Headers: Sequence<HttpHeader> The response header sequence.
IsSuccessStatusCode: bool Whether the response status is in the successful 200–299 range.
ReasonPhrase: string The exact HTTP/1.1 reason text, including an empty phrase. Success depends only on StatusCode. Custom incoming text is decoded on first access and cached; no body read is performed…
Request: Optional<HttpRequest> The effective client request passed to the handler, including applied defaults.
StatusCode: HttpStatusCode The response status as HttpStatusCode; unnamed numeric values remain representable.
Version: HttpVersion The response protocol version. Current transport accepts and emits HTTP/1.1 only.

Methods

9 items
Dispose() -> () Closes owned response content, including an unread streaming connection. 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 the message's Content-Type without consuming its body.
GetHashCode() -> int Returns a stable identity hash by default; an ordinary class may override it consistently with equality. Inherited from Object.GetHashCode
GetHeaderValues(name: string) -> Sequence<string> Gets all matching field values in order using ASCII case-insensitive names. Returns an empty snapshot for absent or invalid names; does not split or join values.
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
Respond(statusCode: HttpStatusCode, content: HttpContent) -> () Sets status and content, replacing Content-Type from the content metadata. Other headers are retained. The context validates and snapshots when completed.
Respond(statusCode: HttpStatusCode) -> () Sets the status and empty content. Does not perform network I/O.
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