FakeResponse class final

The answer of a handler.

Constructors

FakeResponse(int status, [Object? body, Map<String, String> headers = const {}])
A response with status, a JSON body (none when null) and extra headers.
const
FakeResponse.bytes(List<int> bytes, {required String contentType, int status = 200, Map<String, String> headers = const {}})
A response with the binary bytes of contentType (an image/* download such as getBrandingLogo, a file of downloadFile); the contract check sees no JSON body. status is 200 unless a range gives 206; headers adds ETag, Repr-Digest and the like.
const
FakeResponse.noContent()
204 No Content.
const

Properties

body → Object?
The JSON body, or null.
final
bytes → List<int>?
The binary body of FakeResponse.bytes, or null.
final
hashCode → int
The hash code for this object.
no setterinherited
headers → Map<String, String>
Extra headers.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
status → int
The HTTP status.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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