ClientResponse class final

A response to an outgoing request (Laravel's Http\Client\Response).

Constructors

ClientResponse(int status, String body, {Headers? headers})
ClientResponse.fake(Object? body, {int status = 200, Map<String, String> headers = const {}})
A stubbed response: maps and lists become JSON.
factory

Properties

body → String
final
clientError → bool
no setter
failed → bool
no setter
hashCode → int
The hash code for this object.
no setterinherited
headers → Headers
final
ok → bool
no setter
redirect → bool
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serverError → bool
no setter
status → int
final
successful → bool
no setter

Methods

json([String? key, Object? fallback]) → Object?
The decoded JSON body, or a value in it by dot path.
jsonMap() → Map<String, Object?>
The decoded JSON object (empty when the body is not one).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
throwIfClientError() → ClientResponse
throwIfFailed() → ClientResponse
Throws RequestException on a 4xx or 5xx response.
throwIfServerError() → ClientResponse
toString() → String
A string representation of this object.
inherited

Operators

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