File tree 1 file changed +2
-16
lines changed
1 file changed +2
-16
lines changed Original file line number Diff line number Diff line change @@ -97,27 +97,13 @@ class ApiService implements Authentication {
97
97
}
98
98
99
99
Future <bool > _isEndpointAvailable (String serverUrl) async {
100
- final Client client = Client ();
101
-
102
100
if (! serverUrl.endsWith ('/api' )) {
103
101
serverUrl += '/api' ;
104
102
}
105
103
106
104
try {
107
- final response = await client
108
- .get (
109
- Uri .parse ("$serverUrl /server-info/ping" ),
110
- headers: getRequestHeaders (),
111
- )
112
- .timeout (const Duration (seconds: 5 ));
113
-
114
- _log.info ("Pinging server with response code ${response .statusCode }" );
115
- if (response.statusCode != 200 ) {
116
- _log.severe (
117
- "Server Gateway Error: ${response .body } - Cannot communicate to the server" ,
118
- );
119
- return false ;
120
- }
105
+ await setEndpoint (serverUrl);
106
+ await serverInfoApi.pingServer ().timeout (Duration (seconds: 5 ));
121
107
} on TimeoutException catch (_) {
122
108
return false ;
123
109
} on SocketException catch (_) {
You can’t perform that action at this time.
0 commit comments