add timeouts

This commit is contained in:
Fabian Freund
2025-09-15 06:56:07 +02:00
parent 1018afc4ae
commit 7ae3e577e8
@@ -51,12 +51,16 @@ class MoatApi {
Future<http.Response> _get(String endpoint) async {
final uri = Uri.parse('$_baseUrl$endpoint');
return await _client.get(uri, headers: _headers);
return await _client
.get(uri, headers: _headers)
.timeout(const Duration(seconds: 15));
}
Future<http.Response> _post(String endpoint, Object body) async {
final uri = Uri.parse('$_baseUrl$endpoint');
return await _client.post(uri, headers: _headers, body: jsonEncode(body));
return await _client
.post(uri, headers: _headers, body: jsonEncode(body))
.timeout(const Duration(seconds: 15));
}
Map<String, String> get _headers => {