ResponseOrigin class sealed

Where a Dio response came from, as stamped by this package's interceptors — read it once instead of re-deriving it from header strings and recorder state.

switch (ResponseOrigin.of(response)) {
  case FixtureOrigin(:final document, :final filePath): // served fixture
  case ReplayOrigin(:final recordedAt):                  // replayed recording
  case LiveOrigin():                                     // anything else
}

Works for error responses too: ResponseOrigin.of(e.response!) on a DioException. Never throws: a malformed stamp yields a ReplayOrigin without a capture time. A request that never produced a response — a FixtureMiss, a replay rejection — carries its case in DioException.error instead.

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

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

Static Methods

of(Response response) ResponseOrigin
Reads the origin stamped on response.