Skip to main content

Request class

An HTTP request whose whole body is in memory before the handler runs. It is the usual parameter of an HttpHandlerAttribute method.

public sealed class Request : RequestHead

Public Members​

namedescription
Body { get; }The request body as the bytes the client sent; empty when the request has no body.

Remarks​

Isoplane creates the request and passes it to the handler; an application does not construct one. The method, path, query, headers and cancellation token are inherited from RequestHead.

To accept an upload too large to hold in memory, declare the handler's parameter as a StreamingRequest instead. An ASP.NET application uses neither type: it reads HttpContext.Request as usual.

Examples​

[HttpHandler]
public static Task<Response> HandleAsync(Request request)
{
if (request.Method != "POST" || request.Path != "/echo")
return Task.FromResult(Response.Text("Not found", 404));
var text = Encoding.UTF8.GetString(request.Body.Span);
return Task.FromResult(Response.Text(text));
}

See Also​