MockStreamedRequest class
- Implemented types
-
- Annotations
-
Properties
-
autoRetry
↔ RequestAutoRetry
-
Configuration of automatic request retrying for failed requests. Use this
object to enable or disable automatic retrying, configure the criteria
that determines whether or not a request should be retried, as well as the
number of retries to attempt.
getter/setter pairinherited
-
body
↔ Stream<List<int>>?
-
Get the byte stream that will be sent as this request's body.
getter/setter pairinherited
-
client
↔ Object?
-
The underlying HTTP client instance. In the browser, this will be null
because there is no HTTP client API available. In the VM, this will be an
instance of
dart:io.HttpClient
.
getter/setter pairinherited
-
configureFn
↔ Function?
-
Configuration callback for advanced request configuration.
See
configure
.
getter/setter pairinherited
-
contentLength
↔ int?
-
Gets the content length of the request. If the size of the request is not
known in advance, the content length should be null.
getter/setter pairinherited
-
contentType
↔ MediaType?
-
Content-type of this request. Set automatically based on the body type and
the
encoding
.
getter/setter pairinherited
-
defaultContentType
→ MediaType
-
Default content-type. This will depend on the type of request and should
be implemented by the subclasses.
no setterinherited
-
didSucceed
↔ bool
-
Whether or not the request has completed successfully.
getter/setter pairinherited
-
done
→ Future<Null>
-
Future that resolves when the request has completed (successful or
otherwise).
no setterinherited
-
downloadProgress
→ Stream<RequestProgress>
-
RequestProgress stream for this HTTP request's download.
no setterinherited
-
downloadProgressController
↔ StreamController<RequestProgress>
-
RequestProgress stream controller for this HTTP request's download.
getter/setter pairinherited
-
encoding
↔ Encoding
-
Encoding to use to encode/decode the request body.
getter/setter pairinherited
-
fragment
↔ String
-
The URI fragment or hash.
getter/setter pairinherited
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
Get the request headers to be sent with this HTTP request.
getter/setter pairinherited
-
host
↔ String
-
The URI host, including sub-domains and the tld.
getter/setter pairinherited
-
isCanceled
↔ bool
-
Whether or not the request has been canceled by the caller.
getter/setter pairinherited
-
isDone
→ bool
-
Returns
true
if this request is complete (successful or failed), false
otherwise.
no setterinherited
-
isMockAware
→ bool
-
Whether or not this request is wrapped in a mock-aware class.
no setterinherited
-
isSent
↔ bool
-
Whether or not the request has been sent.
getter/setter pairinherited
-
isTimedOut
↔ bool
-
Whether or not the request timed out.
getter/setter pairinherited
-
method
↔ String?
-
HTTP method ('GET', 'POST', etc).
getter/setter pairinherited
-
onCanceled
→ Future<Null>
-
no setterinherited
-
onSent
→ Future<FinalizedRequest>
-
no setterinherited
-
path
↔ String
-
The URI path.
getter/setter pairinherited
-
pathSegments
↔ Iterable<String>
-
The URI path segments.
getter/setter pairinherited
-
port
↔ int
-
The URI port number.
getter/setter pairinherited
-
query
↔ String
-
The URI query string.
getter/setter pairinherited
-
queryParameters
↔ Map<String, String>
-
The URI query parameters.
getter/setter pairinherited
-
queryParametersAll
↔ Map<String, List<String>>
-
The URI query parameters with support for multi-value params.
getter/setter pairinherited
-
requestInterceptor
↔ RequestInterceptor?
-
Request interceptor. Called right before request is sent.
getter/setter pairinherited
-
responseInterceptor
↔ ResponseInterceptor?
-
Response interceptor. Called after response is received and before it is
delivered to the request sender.
getter/setter pairinherited
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
-
scheme
↔ String
-
The URI scheme or protocol. Examples:
http
, https
, ws
.
getter/setter pairinherited
-
timeoutThreshold
↔ Duration?
-
Amount of time to wait for the request to finish before canceling it and
considering it "timed out" (results in a RequestException being thrown).
getter/setter pairinherited
-
uploadProgress
→ Stream<RequestProgress>
-
RequestProgress stream for this HTTP request's upload.
no setterinherited
-
uploadProgressController
↔ StreamController<RequestProgress>
-
RequestProgress stream controller for this HTTP request's upload.
getter/setter pairinherited
-
uri
↔ Uri
-
The full URI.
getter/setter pairinherited
-
wasContentTypeSetManually
→ bool
-
Whether or not the content-type was set manually.
no setterinherited
-
withCredentials
↔ bool
-
Whether or not to send the request with credentials.
getter/setter pairinherited
Methods
-
abort([Object? error])
→ void
-
Cancel this request. If the request has already finished, this will do
nothing.
inherited
-
abortRequest()
→ void
-
Abort the request using the underlying HTTP API.
inherited
-
addPathSegment(String pathSegment)
→ void
-
Add a single path segment to the end of the current path.
inherited
-
appendToPath(String pathToAppend)
→ void
-
Append to the current path.
inherited
-
causeFailureOnOpen()
→ void
-
inherited
-
checkForCancellation({BaseResponse? response})
→ void
-
Check if this request has been canceled.
inherited
-
checkForTimeout()
→ void
-
Check if this request has exceeded the timeout threshold.
inherited
-
cleanUp()
→ void
-
Perform any cleanup that may be necessary after the request has completed
(either successfully or not).
inherited
-
clone()
→ StreamedRequest
-
Returns a clone of this request.
inherited
-
complete({BaseResponse? response})
→ void
-
inherited
-
completeError({Object? error, BaseResponse? response})
→ void
-
inherited
-
configure(dynamic configure(Object request))
→ void
-
Allows more advanced configuration of this request prior to sending.
The supplied callback
configureRequest
should be called after opening,
but prior to sending, this request. The request
parameter will either
be an instance of HttpRequest or HttpClientRequest,
depending on the w_transport usage. If configureRequest
returns a Future,
the request will not be sent until the returned Future completes.
inherited
-
createRealRequest()
→ StreamedRequest
-
-
delete({Uri? uri})
→ Future<Response>
-
Send a DELETE request.
inherited
-
finalizeBody([dynamic body])
→ Future<StreamedHttpBody>
-
Finalize the request body. If a body was supplied to the request dispatch
method, it will be available as
body
. Otherwise the body from this
request should be used.
inherited
-
Finalize the request headers, in particular the content-length and
content-type headers since they depend on the request body. The returned
map should be unmodifiable.
inherited
-
finalizeRequest([dynamic body])
→ Future<FinalizedRequest>
-
Freeze this request in preparation of it being sent. This freezes all
fields, preventing further unexpected modification, and triggers the
creation of a finalized request body.
inherited
-
get({Uri? uri})
→ Future<Response>
-
Send a GET request.
inherited
-
head({Uri? uri})
→ Future<Response>
-
Send a HEAD request.
inherited
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
openRequest([Object? _])
→ Future<Null>
-
Open the request. If
client
is given, that client should be used to open
the request.
inherited
-
options({Uri? uri})
→ Future<Response>
-
Send an OPTIONS request.
inherited
-
patch({dynamic body, Uri? uri})
→ Future<Response>
-
Send a PATCH request.
inherited
-
post({dynamic body, Uri? uri})
→ Future<Response>
-
Send a POST request.
inherited
-
put({dynamic body, Uri? uri})
→ Future<Response>
-
Send a PUT request.
inherited
-
removeQueryParam(String param)
→ void
-
Remove
param
from the URI query parameters.
inherited
-
retry()
→ Future<Response>
-
Retry this request. Throws a
StateError
if this request did not or has
yet to fail.
inherited
-
send(String? method, {dynamic body, Uri? uri})
→ Future<Response>
-
Send an HTTP request with a custom
method
.
inherited
-
sendRequestAndFetchResponse(FinalizedRequest finalizedRequest, {bool streamResponse = false})
→ Future<BaseResponse>
-
Send the request described in
finalizedRequest
and fetch the response.
If streamResponse
is true, the response should be streamed.
inherited
-
setQueryParam(String param, dynamic value)
→ void
-
Set a single query parameter.
inherited
-
streamDelete({Uri? uri})
→ Future<StreamedResponse>
-
Send a DELETE request. The response will be streamed, meaning the body
will be available asynchronously. This is useful for large response bodies
or for proxies.
inherited
-
streamGet({Uri? uri})
→ Future<StreamedResponse>
-
Send a GET request. The response will be streamed, meaning the body will
be available asynchronously. This is useful for large response bodies or
for proxies.
inherited
-
streamHead({Uri? uri})
→ Future<StreamedResponse>
-
Send a HEAD request. The response will be streamed, meaning the body will
be available asynchronously. This is useful for large response bodies or
for proxies.
inherited
-
streamOptions({Uri? uri})
→ Future<StreamedResponse>
-
Send an OPTIONS request. The response will be streamed, meaning the body
will be available asynchronously. This is useful for large response bodies
or for proxies.
inherited
-
streamPatch({dynamic body, Uri? uri})
→ Future<StreamedResponse>
-
Send a PATCH request. The response will be streamed, meaning the body will
be available asynchronously. This is useful for large response bodies or
for proxies.
inherited
-
streamPost({dynamic body, Uri? uri})
→ Future<StreamedResponse>
-
Send a POST request. The response will be streamed, meaning the body will
be available asynchronously. This is useful for large response bodies or
for proxies.
inherited
-
streamPut({dynamic body, Uri? uri})
→ Future<StreamedResponse>
-
Send a PUT request. The response will be streamed, meaning the body will
be available asynchronously. This is useful for large response bodies or
for proxies.
inherited
-
streamRetry()
→ Future<StreamedResponse>
-
Retry this request and stream the response. Throws a
StateError
if this
request did not or has yet to fail.
inherited
-
streamSend(String? method, {dynamic body, Uri? uri})
→ Future<StreamedResponse>
-
Send an HTTP request with a custom
method
. The response will be
streamed, meaning the body will be available asynchronously. This is
useful for large response bodies or for proxies.
inherited
-
switchToRealRequest({bool? streamResponse})
→ CommonRequest
-
When a mock request is sent, we check to see if there is a mock
expectation or handler setup to handle the request. If not, we switch to
a real request instance (created from a TransportPlatform instance).
inherited
-
toString()
→ String
-
A string representation of this object.
inherited
-
updateContentType(MediaType? contentType)
→ void
-
Set the content-type of this request. Used to update the charset
parameter when the encoding changes.
inherited
-
updateQuery(Map<String, dynamic> queryParametersToUpdate, {bool mergeValues = false})
→ void
-
Update the URI query parameters, merging the given map with the
current query parameters map instead of overwriting it.
inherited
-
verifyUnsent()
→ void
-
Verify that this request has not yet been sent. Once it has, all fields
should be considered frozen. If this request has been sent, this throws
a StateError.
inherited