http_recorder library

Record and replay HTTP requests and responses, for repeatability in tests.

Repeatability of HTTP requests within tests can be maintained with the following package features:

  • Automatically record HTTP requests and responses into json files
  • Respond to subsequent HTTP requests using prior recordings
  • Manually mock responses to specific requests

Classes

HttpRecorder
Configures an HTTP client that can record and replay HTTP responses, for more repeatable and less flakey tests.
HttpRecorderClient
HTTP client that can record and replay HTTP requests and responses.
RecordIntercept
This class lets you set the value to respond with during an HTTP request intecept.
RecordInterceptor
This class lets you intercept HTTP requests made to an HTTP recording client and return a known response instead of a recorded or actual message.
RecordRequest
Represents a request for an HTTP recording.
RecordResponse
Represents the full response to an HTTP request.

Constants

defaultRecorderTagObject → const Object
The default tag parameter. The parameter is allowed to be null so we need something to compare against.

Properties

debugLog LoggingCallback
no getter
globalHttpRecorder HttpRecorder?
Set the global http recorder which will be used by runWithRecording, testRecording, and testRecordingWidgets.
no getter

Functions

resetDebugLog() → void
runWithRecording<T>(RecordingTesterCallback<T> body) → T
setupRecordingOnDrawFrame() → void
Setup the Http recording client to be available on every frame draw.
testRecording(String description, RecordingTesterCallback body, {bool? skip, Object? tags = defaultRecorderTagObject}) → void
testRecordingWidgets(String description, RecordingWidgetTesterCallback test, {bool useFakeAsync = false, bool? skip, Object? tags = defaultRecorderTagObject}) → void

Typedefs

LoggingCallback = void Function(String log)
RecordingTesterCallback<T> = T Function(RecordInterceptor interceptor)
RecordingWidgetTesterCallback = Future<void> Function(WidgetTester tester, RecordInterceptor interceptor)

Exceptions / Errors

RecordingNotFoundException
An exception thrown when an HTTP recording is not found.