Request class

Request class.

Represents a HTTP request.

The framework will invoke the request handlers or exception handlers of a Server with an instance of this class. That request object will be created from the real HTTP request.

For testing, with the Server.simulate method, instances can be created using the Request.simulated constructor or one of the convenience constructors: Request.simulatedGet or Request.simulatedPost.

Constructors

Request(HttpRequest hReq, String id, Server server)
Constructor
Request.simulated(String method, String internalPath, {String? id, String? sessionId, RequestParams? queryParams, HttpConnectionInfo? connectionInfo, X509Certificate? certificate, SimulatedHttpHeaders? headers, List<Cookie>? cookies, String? bodyStr, List<int>? bodyBytes, int? bodyStreamEventSize, RequestParams? postParams})
Creates a simulated request.
Request.simulatedGet(String internalPath, {String? sessionId, String? id, RequestParams? pathParams, RequestParams? queryParams, HttpConnectionInfo? connectionInfo, X509Certificate? certificate, SimulatedHttpHeaders? headers, List<Cookie>? cookies, String? bodyStr, List<int>? bodyBytes, int? bodyStreamEventSize})
Convenience method for creating a simulated GET request.
Request.simulatedPost(String internalPath, RequestParams? postParams, {String? sessionId, String? id, RequestParams? queryParams, HttpConnectionInfo? connectionInfo, X509Certificate? certificate, SimulatedHttpHeaders? headers, List<Cookie>? cookies, String? bodyStr, List<int>? bodyBytes, int? bodyStreamEventSize})
Constructor for a simulated Post request.

Properties

certificate X509Certificate?
Client certificate for client authenticated TLS connections.
no setter
connectionInfo HttpConnectionInfo?
Information about the client connection.
no setter
cookies Iterable<Cookie>
Cookies
no setter
hashCode int
The hash code for this object.
no setterinherited
headers HttpHeaders
HTTP request headers.
no setter
id String
An identity for the request.
no setter
method String
Request HTTP method
no setter
pathParams RequestParams
The three different sources of parameters.
getter/setter pair
postParams RequestParams?
The parameters from a 'application/x-www-form-urlencoded' request: typically from a POST request from a HTML form.
getter/setter pair
queryParams RequestParams
The parameters from the query parameters in the URL.
getter/setter pair
request HttpRequest
Returns the underlying HttpRequest.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
server Server
The server that received this request.
no setter
session Session?
The session associated with the context or null.
getter/setter pair

Methods

bodyBytes(int maxBytes) Future<List<int>>
The entire body of the request as a list of bytes.
bodyStr(int maxBytes) Future<String>
The entire body of the request as a string.
bodyStream() Stream<Uint8List>
The body of the request as a stream of bytes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
release() Future
Release method
requestPath() String
The request path as a String.
rewriteUrl(String internalPath, {bool? includeSession}) String
Convert an internal path to an external path.
sessionHiddenInputElement() String
Returns HTML for a hidden form input for the session parameter.
toString() String
A string representation of this object.
inherited
ura(String internalPath, {bool? includeSession}) String
Rewrite an internal path and encode for an attribute.

Operators

operator ==(Object other) bool
The equality operator.
inherited