DVHttp class
DV.Http.
Constructors
- DVHttp()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
declare(
String name, DVHttpHostConfig config) → void -
Declares
name. Declaring it again replaces it, and starts its breaker and pool afresh. -
declareFromConfig(
Map< String, Object?> http) → void -
Declares every host in a
dartvel.httpblock. -
delete(
Object url, {Map< String, String> headers = const <String, String>{}, int? attempts}) → Future<Response> -
fake(
Map< String, DVHttpStub> stubs) → DVHttpFake -
Answers every outbound request from
stubs, by declared host name or by the host part of an absolute URL, and refuses any request no stub answers (DV-HTTP-004). -
get(
Object url, {Map< String, String> headers = const <String, String>{}, int? attempts}) → Future<Response> -
head(
Object url, {Map< String, String> headers = const <String, String>{}, int? attempts}) → Future<Response> -
host(
String name) → DVHttpHost -
The declared host
name. ThrowsDV-HTTP-001when there is none. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
patch(
Object url, {Object? json, Object? body, Map< String, String> headers = const <String, String>{}, String? idempotencyKey, int? attempts}) → Future<Response> -
post(
Object url, {Object? json, Object? body, Map< String, String> headers = const <String, String>{}, String? idempotencyKey, int? attempts}) → Future<Response> -
put(
Object url, {Object? json, Object? body, Map< String, String> headers = const <String, String>{}, String? idempotencyKey, int? attempts}) → Future<Response> -
record(
List< DVHttpFixture> into) → void -
Appends a DVHttpFixture to
intofor every real response, until stopRecording. -
send(
String method, Object url, {Object? json, Object? body, Map< String, String> headers = const <String, String>{}, String? idempotencyKey, int? attempts, String? connectAddress, bool allowUndeclaredHost = false}) → Future<Response> - Sends to an absolute URL, as the declared host whose base URL it is under: that host's credential, timeout, retries, breaker and pool.
-
stopRecording(
) → void -
toString(
) → String -
A string representation of this object.
inherited
-
unfake(
) → void - Back to the real wire.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- clock ↔ DateTime Function()
-
The breaker's clock.
getter/setter pair
- random ↔ Random
-
The jitter source.
getter/setter pair
-
sleep
↔ Future<
void> Function(Duration duration) -
How retries wait. Replaceable so a test is not slowed by its own backoff.
getter/setter pair
- transport ↔ DVHttpStreamSend?
-
The wire. Null means dvStreamHttpRequest, which walks the installed
transports — including the native HTTP/2 client when it is present.
getter/setter pair
Static Methods
-
coveringHost(
Map< String, DVHttpHostConfig> hosts, Uri url) → String? -
The name of the host in
hostswhose base URLurlis under -- same scheme, host and port, and a path at or below the base path -- preferring the longest base URL, or null when none covers it. -
readConfig(
Map< Object?, Object?> http) → Map<String, DVHttpHostConfig> -
Reads and checks a
dartvel.httpblock into its hosts, declaring nothing. The generator checks a pubspec with this before it writes a file, and the application declares with the same reader at startup, so the two cannot disagree about what the block says. -
reset(
) → void - Forgets every declared host, breaker, pool, fake and recording, and puts the wire, the clock and the sleep back.