Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/http/intercepted_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class InterceptedClient extends BaseClient {

@override
Future<StreamedResponse> send(BaseRequest request) async {
final response = await _attemptRequest(request);
final response = await _attemptRequest(request, isStream: true);

final interceptedResponse = await _interceptResponse(response);

Expand Down Expand Up @@ -266,7 +266,8 @@ class InterceptedClient extends BaseClient {

/// Attempts to perform the request and intercept the data
/// of the response
Future<BaseResponse> _attemptRequest(BaseRequest request) async {
Future<BaseResponse> _attemptRequest(BaseRequest request,
{bool isStream = false}) async {
BaseResponse response;
try {
// Intercept request
Expand All @@ -278,8 +279,7 @@ class InterceptedClient extends BaseClient {
.send(interceptedRequest)
.timeout(requestTimeout!, onTimeout: onRequestTimeout);

response =
request is Request ? await Response.fromStream(stream) : stream;
response = isStream ? stream : await Response.fromStream(stream);

if (retryPolicy != null &&
retryPolicy!.maxRetryAttempts > _retryCount &&
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ environment:
sdk: ">=3.0.3 <4.0.0"

dependencies:
http: ^1.0.0
http: ^1.1.0

dev_dependencies:
lints: ^2.1.1
Expand Down