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

Update connectivity_util.dart #13

Merged
merged 1 commit into from
May 17, 2020
Merged
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
4 changes: 2 additions & 2 deletions lib/src/connectivity_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ConnectivityUtils {
/// Server to ping
///
/// The server to ping and check the response, can be set with [setServerToPing]
String _serverToPing = "http://www.google.com";
String _serverToPing = "http://www.gstatic.com/generate_204";

/// Verify Response Callback
///
Expand Down Expand Up @@ -90,7 +90,7 @@ class ConnectivityUtils {

// ignore: close_sinks
final result = await http.get(_serverToPing);
if (result.statusCode == 200 && _callback(result.body)) {
if (result.statusCode > 199 && result.statusCode < 400 && _callback(result.body)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, since custom servers might return results other than 200!

return true;
}
} catch (e) {
Expand Down