Fixed test server reachability
This commit is contained in:
@@ -11,8 +11,13 @@ import 'package:linkdy/models/server_instance.dart';
|
|||||||
|
|
||||||
Future<bool> testServerReachability(String url) async {
|
Future<bool> testServerReachability(String url) async {
|
||||||
try {
|
try {
|
||||||
await Dio().get(url);
|
await Dio(BaseOptions(connectTimeout: const Duration(seconds: 5))).get("$url/api/");
|
||||||
return true;
|
return true;
|
||||||
|
} on DioException catch (e) {
|
||||||
|
if (e.response?.statusCode != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user