build property

Future<ApiRequest<ResponseType, InnerType>> get build

Runs the onRequest interceptors and returns the resulting request.

Awaits each hook, so an interceptor may refresh a token or read from storage before the request goes out.

Interceptor exceptions are intentionally not caught here — callers run this inside their own error handling so a throwing interceptor is reported rather than silently skipped.

Implementation

Future<ApiRequest<ResponseType, InnerType>> get build async {
  var request = this;
  for (final interceptor in interceptors) {
    request = await interceptor.onRequest(request);
  }
  return request;
}