TurboBridgeHttpInterceptor class

HttpInterceptor that records every HTTP exchange into the DevTools timeline. Drop it into an InterceptedClient / InterceptedHttp:

final client = InterceptedClient.build(
  interceptors: [TurboBridgeHttpInterceptor()],
);

Constructors

TurboBridgeHttpInterceptor({String urlFor(BaseRequest request)?, int maxBodySize = 16 * 1024, bool captureResponseBody = true})

Properties

captureResponseBody bool
When true (the default) the interceptor buffers the response stream so it can record the body excerpt and emit it to the timeline. The buffered bytes are then re-emitted as a fresh single-shot stream so downstream consumers (and Response.fromStream) see the response unchanged.
final
hashCode int
The hash code for this object.
no setterinherited
maxBodySize int
Cap on the body size we record (bytes). Bodies above this cap are truncated. Defaults to 16 KB.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
urlFor String Function(BaseRequest request)?
Optional override for the URL to record. Defaults to request.url.toString(). Use this if you want to strip query strings, mask secrets in the path, or rewrite the host.
final

Methods

interceptRequest({required BaseRequest request}) FutureOr<BaseRequest>
Runs before the request is sent. Return the (possibly modified) request.
interceptResponse({required BaseResponse response}) FutureOr<BaseResponse>
Runs after the response is received. Return the (possibly modified) response.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
retryPolicy({RetryPolicy? wrapping}) → RetryPolicy
Builds a RetryPolicy that records exchanges whose underlying Client.send threw (DNS failure, timeout, connection refused) into the timeline — the failures the interceptor's interceptResponse can't see. Pass it as the InterceptedClient / InterceptedHttp retryPolicy.
shouldInterceptRequest({required BaseRequest request}) FutureOr<bool>
Whether to run interceptRequest for this request. Defaults to true.
shouldInterceptResponse({required BaseResponse response}) FutureOr<bool>
Whether to run interceptResponse for this response. Defaults to true.
toString() String
A string representation of this object.
inherited

Operators

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