Skip to content
Snippets Groups Projects
Commit 7df8401c authored by vjrj's avatar vjrj
Browse files

Correct wot call

parent 78e70311
Branches master
No related merge requests found
...@@ -55,8 +55,10 @@ Not found sample: ...@@ -55,8 +55,10 @@ Not found sample:
} }
*/ */
Future<Contact> getWot(Contact contact) async { Future<Contact> getWot(Contact contact) async {
final Response response = final Response response = await requestDuniterWithRetry(
await requestCPlusWithRetry('/wot/lookup/${contact.pubkey}'); '/wot/lookup/${contact.pubkey}',
retryWith404: false);
// Will be better to analyze the 404 response (to detect faulty node)
if (response.statusCode == HttpStatus.ok) { if (response.statusCode == HttpStatus.ok) {
final Map<String, dynamic> data = final Map<String, dynamic> data =
json.decode(response.body) as Map<String, dynamic>; json.decode(response.body) as Map<String, dynamic>;
...@@ -291,6 +293,11 @@ Future<http.Response> requestWithRetry(NodeType type, String path, ...@@ -291,6 +293,11 @@ Future<http.Response> requestWithRetry(NodeType type, String path,
return _requestWithRetry(type, path, dontRecord, retryWith404); return _requestWithRetry(type, path, dontRecord, retryWith404);
} }
Future<http.Response> requestDuniterWithRetry(String path,
{bool retryWith404 = true}) async {
return _requestWithRetry(NodeType.duniter, path, true, retryWith404);
}
Future<http.Response> requestCPlusWithRetry(String path, Future<http.Response> requestCPlusWithRetry(String path,
{bool retryWith404 = true}) async { {bool retryWith404 = true}) async {
return _requestWithRetry(NodeType.cesiumPlus, path, true, retryWith404); return _requestWithRetry(NodeType.cesiumPlus, path, true, retryWith404);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment