HttpRequest class

An HTTP request with the information which client to use.

Inheritance

Constructors

HttpRequest.new({RhttpClient? client, ClientSettings? settings, Interceptor? interceptor, HttpMethod method = HttpMethod.get, required String url, Map<String, String>? query, HttpHeaders? headers, HttpBody? body, HttpExpectBody expectBody = HttpExpectBody.stream, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress})
HttpRequest.from({required BaseHttpRequest request, RhttpClient? client, ClientSettings? settings, Interceptor? interceptor})
factory

Properties

additionalData Map<String, dynamic>
Map that can be used to store additional information. Primarily used by interceptors. This is not const to allow for modifications.
finalinherited
body HttpBody?
The body of the request.
finalinherited
cancelToken CancelToken?
The cancel token to use for the request.
finalinherited
client RhttpClient?
The client to use for the request.
final
expectBody HttpExpectBody
The expected body type of the response.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
headers HttpHeaders?
Headers to send with the request.
finalinherited
interceptor Interceptor?
The interceptor to use for the request. This can be a SequentialInterceptor if there are multiple interceptors.
final
method HttpMethod
The HTTP method to use.
finalinherited
onReceiveProgress ProgressCallback?
Receive progress callback.
finalinherited
onSendProgress ProgressCallback?
Send progress callback.
finalinherited
query Map<String, String>?
Query parameters. This can be null, if there are no query parameters or if they are already part of the URL.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
settings ClientSettings?
The settings to use for the request.
final
url String
The URL to request.
finalinherited

Methods

addHeader({required HttpHeaderName name, required String value}) HttpRequest
Convenience method to add a header to the request. Returns a new instance of HttpRequest with the added header.
copyWith({RhttpClient? client, ClientSettings? settings, HttpMethod? method, String? url, Map<String, String>? query = _keepQuery, HttpHeaders? headers = _keepHeaders, HttpBody? body = _keepBody, HttpExpectBody? expectBody, CancelToken? cancelToken}) HttpRequest
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send() Future<HttpResponse>
Sends the request using the specified client / settings and returns the response.
toString() String
A string representation of this object.
inherited

Operators

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