Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥 Remove redundant warnings #2309

Merged
merged 3 commits into from
Oct 7, 2024
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
7 changes: 3 additions & 4 deletions dio/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ See the [Migration Guide][] for the complete breaking changes list.**

## Unreleased

*None.*
- 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