processResponse method

Future<FittorResponse> processResponse(
  1. FittorResponse response
)

Executes all response interceptors in reverse order

Response interceptors are executed in reverse order so that the last added interceptor processes the response first.

response The initial response Returns the final processed response

Implementation

Future<FittorResponse> processResponse(FittorResponse response) async {
  var currentResponse = response;

  // Execute in reverse order for responses
  for (final interceptor in _interceptors.reversed) {
    currentResponse = await interceptor.onResponse(currentResponse);
  }

  return currentResponse;
}