Instances of this type represent an HTTP request to be executed with a TestClient.

There is no need to instantiate this class directly. See TestClient.request, TestClient.clientAuthenticatedRequest, and TestClient.authenticatedRequest. Once returned an instance from one of these methods, you may configure additional properties before executing it with methods like TestRequest.get, TestRequest.post, etc.

Instances of this class will create instances of TestResponse once executed that can be used in test expectations. See also hasResponse and hasStatus.

Constructors

TestRequest()

Properties

accept → List<ContentType>

Sets the Accept header of this request.

write-only
baseURL → String

The base URL of the request.

read / write
bearerAuthorization → String

Sets the Authorization header of this request.

write-only
body → dynamic

The HTTP request body.

read / write
contentType → ContentType

The Content-Type of the body.

read / write
encodeBody → bool

Whether or not body should be encoded according to contentType.

read / write
formData → Map<String, String>

Form-data encodes a serialized value into body and sets contentType.

write-only
headers → Map<String, dynamic>

HTTP headers to add to the request.

read / write
json → dynamic

JSON encodes a serialized value into body and sets contentType.

write-only
path → String

The path of the request; will be appended to baseURL.

read / write
queryParameters → Map<String, dynamic>

Query parameters to add to the request.

read / write
requestURL → String

The full URL of this request.

read-only
hashCode → int

The hash code for this object.

read-only, inherited
runtimeType → Type

A representation of the runtime type of the object.

read-only, inherited

Operators

operator ==(other) → bool

The equality operator.

inherited

Methods

addHeader(String name, String value) → void

Adds a header to this request.

delete() → Future<TestResponse>

Executes this request with HTTP DELETE.

get() → Future<TestResponse>

Executes this request with HTTP GET.

method(String verb) → Future<TestResponse>

Executes this request with the given HTTP verb.

post() → Future<TestResponse>

Executes this request with HTTP POST.

put() → Future<TestResponse>

Executes this request with HTTP PUT.

setBasicAuthorization(String username, String password) → void

Sets the Authorization header of this request.

setBody(body, { ContentType contentType }) → void

Sets the body and contentType.

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
toString() → String

Returns a string representation of this object.

inherited