Skip to content

Commit

Permalink
Merge branch 'main' into chore/multipart-file-comment
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Li <github@alexv525.com>
  • Loading branch information
AlexV525 authored Oct 7, 2024
2 parents 9d00d97 + 945d487 commit 8b7f500
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
6 changes: 3 additions & 3 deletions dio/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ See the [Migration Guide][] for the complete breaking changes list.**
## Unreleased

- Update comments and strings with `MultipartFile`.
- Removes redundant warnings when composing request options on Web.

## 5.7.0

- Graceful handling of responses with nonzero `Content-Length`, `Content-Type` json, but empty body
- Empty responses are now transformed to `null`

- Graceful handling of responses with nonzero `Content-Length`, `Content-Type` that is json, and empty payload.
- Empty responses are now transformed to `null`.

## 5.6.0

Expand Down
14 changes: 0 additions & 14 deletions dio/lib/src/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -309,20 +309,6 @@ class Options {
ProgressCallback? onReceiveProgress,
StackTrace? sourceStackTrace,
}) {
if (data != null && kIsWeb) {
if (sendTimeout != null && sendTimeout! > Duration.zero) {
warningLog(
'sendTimeout cannot be used without a request body to send on Web',
StackTrace.current,
);
}
if (onSendProgress != null) {
warningLog(
'onSendProgress cannot be used without a request body to send on Web',
StackTrace.current,
);
}
}
final query = <String, dynamic>{};
query.addAll(baseOpt.queryParameters);
if (queryParameters != null) {
Expand Down
9 changes: 5 additions & 4 deletions plugins/web_adapter/lib/src/adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ class BrowserHttpClientAdapter implements HttpClientAdapter {
}
});

final onSendProgress = options.onSendProgress;
final sendTimeout = options.sendTimeout ?? Duration.zero;
final connectTimeout = options.connectTimeout ?? Duration.zero;
final receiveTimeout = options.receiveTimeout ?? Duration.zero;

final xhrTimeout = (connectTimeout + receiveTimeout).inMilliseconds;
xhr.timeout = xhrTimeout;

Expand Down Expand Up @@ -138,7 +140,6 @@ class BrowserHttpClientAdapter implements HttpClientAdapter {
});
}

final onSendProgress = options.onSendProgress;
if (onSendProgress != null) {
xhrUploadProgressStream.listen((event) {
onSendProgress(event.loaded, event.total);
Expand All @@ -147,13 +148,13 @@ class BrowserHttpClientAdapter implements HttpClientAdapter {
} else {
if (sendTimeout > Duration.zero) {
warningLog(
'sendTimeout cannot be used without a request body to send',
'sendTimeout cannot be used without a request body to send on Web',
StackTrace.current,
);
}
if (options.onSendProgress != null) {
if (onSendProgress != null) {
warningLog(
'onSendProgress cannot be used without a request body to send',
'onSendProgress cannot be used without a request body to send on Web',
StackTrace.current,
);
}
Expand Down

0 comments on commit 8b7f500

Please sign in to comment.