Skip to content

Commit

Permalink
onReattemptableResponse: return response status code instead of Strea…
Browse files Browse the repository at this point in the history
…medResponse
  • Loading branch information
devj3ns committed Oct 14, 2024
1 parent bd29927 commit f78bb9d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class OfflineFirstWithRestRepository
/// which is present in the [reattemptForStatusCodes] list.
///
/// Forwarded to [RestOfflineQueueClient].
void Function(http.Request request, http.StreamedResponse response)? onReattemptableResponse;
void Function(http.Request request, int statusCode)? onReattemptableResponse;

/// A callback triggered when a request throws an exception during execution.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RestOfflineQueueClient extends http.BaseClient {

/// A callback triggered when the response of a request has a status code
/// which is present in the [reattemptForStatusCodes] list.
void Function(http.Request request, http.StreamedResponse response)? onReattemptableResponse;
void Function(http.Request request, int statusCode)? onReattemptableResponse;

/// A callback triggered when a request throws an exception during execution.
///
Expand Down Expand Up @@ -110,7 +110,7 @@ class RestOfflineQueueClient extends http.BaseClient {
_logger.finer(
'request failed, will be reattempted: ${cacheItem.toSqlite()}',
);
onReattemptableResponse?.call(request, resp);
onReattemptableResponse?.call(request, resp.statusCode);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ abstract class OfflineFirstWithSupabaseRepository
504,
],
bool? serialProcessing,
void Function(http.Request request, http.StreamedResponse response)? onReattemptableResponse,
void Function(http.Request request, int statusCode)? onReattemptableResponse,
void Function(http.Request, Object)? onRequestError,
}) {
final client = RestOfflineQueueClient(
Expand Down

0 comments on commit f78bb9d

Please sign in to comment.