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

API Browser

Class

HttpRequest

class HttpRequest

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

Inheritance: Object → HttpRequest
Implements: Disposable

An HTTP request with a validated HttpMethod and content; Create accepts predefined and custom methods. Factories validate the supported URL subset.

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.

Properties

8 items
Content: HttpContent Request body content. Incoming nonempty bodies are consumed asynchronously on demand.
Headers: Sequence<HttpHeader> Received request headers in wire order, with lowercase names and trimmed surrounding whitespace.
Host: string ASCII host without port.
IsSecure: bool Whether the request uses authenticated HTTPS transport.
Method: HttpMethod The validated method value. Its Method property preserves the wire spelling.
Port: int TCP port, default 80.
Target: string Slash-prefixed target, default /.
Version: HttpVersion The request protocol version, available after headers. Current transport supports HTTP/1.1 only.

Methods

24 items
Static member: Create(method: HttpMethod, uri: Uri, content: HttpContent) -> Result<HttpRequest, HttpError> Constructs a URI-based request with explicit method and content.
Static member: Create(method: HttpMethod, uri: Uri) -> Result<HttpRequest, HttpError> Constructs a URI-based request using a predefined or custom method.
Static member: Create(method: HttpMethod, url: string, content: HttpContent) -> Result<HttpRequest, HttpError> Constructs a request with explicit method and content; transport bounds apply when sent.
Static member: Create(method: HttpMethod, url: string) -> Result<HttpRequest, HttpError> Constructs a request using a predefined or custom method, without performing I/O.
Static member: Delete(uri: Uri) -> Result<HttpRequest, HttpError> Constructs an absolute HTTP DELETE request without content.
Static member: Delete(url: string) -> Result<HttpRequest, HttpError> Constructs an absolute HTTP DELETE request without content.
Dispose() -> () Releases owned content without reading or draining it. Safe to repeat. Header-derived copies share content; disposal affects every alias. Implements Disposable.Dispose
Equals(other: object?) -> bool Tests reference identity by default; an ordinary class may override equality. Inherited from Object.Equals
Static member: Get(uri: Uri) -> Result<HttpRequest, HttpError> Constructs a GET request from an absolute URI; unsupported HTTP forms remain errors.
Static member: Get(url: string) -> Result<HttpRequest, HttpError> Parses an absolute HTTP URL and constructs a GET request without performing I/O.
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
Static member: Head(uri: Uri) -> Result<HttpRequest, HttpError> Constructs an absolute HTTP HEAD request without content.
Static member: Head(url: string) -> Result<HttpRequest, HttpError> Constructs an absolute HTTP HEAD request without content.
Static member: Patch(uri: Uri, content: HttpContent) -> Result<HttpRequest, HttpError> Constructs an absolute HTTP PATCH request with buffered content.
Static member: Patch(url: string, content: HttpContent) -> Result<HttpRequest, HttpError> Constructs an absolute HTTP PATCH request with buffered content.
Static member: Post(uri: Uri, content: HttpContent) -> Result<HttpRequest, HttpError> Constructs a POST request from an absolute HTTP URI.
Static member: Post(url: string, content: HttpContent) -> Result<HttpRequest, HttpError> Constructs a POST request without performing I/O.
Static member: Put(uri: Uri, content: HttpContent) -> Result<HttpRequest, HttpError> Constructs an absolute HTTP PUT request with buffered content.
Static member: Put(url: string, content: HttpContent) -> Result<HttpRequest, HttpError> Constructs an absolute HTTP PUT request with buffered content.
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
WithHeader(name: string, value: string) -> Result<HttpRequest, HttpError> Returns a new request with one application header replaced case-insensitively. The original request is unchanged; content is shared and framing stays provider-owned.