TestRequest class final

A request being built for a TestClient.

await (client.post('/orders')
    ..bearer('tok_abc')
    ..json({'item': 'shirt', 'quantity': 2})
    ..expectSuccess())
    .send();

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

basic(String username, String password) → void
Authorization: Basic base64(username:password).
bearer(String token) → void
Authorization: Bearer [token].
bytes(List<int> data, {String contentType = 'application/octet-stream'}) → void
Raw bytes with an explicit contentType.
contentType(String mediaType) → void
Sets content-type without setting a body.
Appends a cookie.
expectFailure() → void
Assert non-2xx after send.
expectSuccess() → void
Assert 2xx after send.
form(Map<String, String> fields) → void
Form-urlencoded fields.
One header.
json(Object body) → void
JSON-encodes body and sets content-type.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
queryParam(String name, String value) → void
Appends a query parameter.
send() Future<TestResponse>
Executes the request.
text(String body) → void
Plain text body.
toString() String
A string representation of this object.
inherited

Operators

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