MockClient class
A mock implementation of an HTTP client. Factory methods simply return the mock implementations of each request. Since the mock request implementations don't ever actually send an HTTP request, this client doesn't need to do anything else.
- Implemented types
- Annotations
-
- @Deprecated(v3Deprecation)
Constructors
- MockClient([TransportPlatform? transport])
Properties
- autoRetry ↔ AutoRetryConfig
-
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
- baseUri ↔ Uri?
-
A base URI that all requests created by this client should inherit.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
↔ Map<
String, String> -
Get and set request headers that will be applied to all requests created
by this HTTP client.
getter/setter pairinherited
- isClosed → bool
-
Whether or not this HTTP client has been closed.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- 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
- withCredentials ↔ bool?
-
Whether or not to send the request with credentials. Only applicable to
requests in the browser, but does not adversely affect any other platform.
getter/setter pairinherited
Methods
-
addInterceptor(
HttpInterceptor interceptor) → void -
inherited
-
close(
) → void -
Closes the client, canceling or closing any outstanding connections.
inherited
-
closeClient(
) → void -
Sub-classes should override this and close the platform-specific client
being used.
inherited
-
newFormRequest(
) → FormRequest -
Constructs a new FormRequest that will use this client to send the
request. Throws a StateError if this client has been closed.
inherited
-
newJsonRequest(
) → JsonRequest -
Constructs a new JsonRequest that will use this client to send the
request. Throws a StateError if this client has been closed.
inherited
-
newMultipartRequest(
) → MultipartRequest -
Constructs a new MultipartRequest that will use this client to send the
request. Throws a StateError if this client has been closed.
inherited
-
newRequest(
) → Request -
Constructs a new Request that will use this client to send the request.
Throws a StateError if this client has been closed.
inherited
-
newStreamedRequest(
) → StreamedRequest -
Constructs a new StreamedRequest that will use this client to send the
request. Throws a StateError if this client has been closed.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerAndDecorateRequest(
BaseRequest request) → void -
Registers a request created by this client so that it will be canceled if
still incomplete when this client is closed. Also decorates the request by
adding headers that are set on this client and setting the withCredentials
flag.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
verifyNotClosed(
) → void -
Throws a StateError if this client has been closed.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited