mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 20:09:23 +00:00
WIP: sample stub for possible tor integration
This commit is contained in:
parent
05dc2a23e6
commit
e940ad8e71
1 changed files with 40 additions and 0 deletions
40
lib/networking/http.dart
Normal file
40
lib/networking/http.dart
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
// WIP wrapper layer
|
||||||
|
|
||||||
|
abstract class HTTP {
|
||||||
|
static Future<http.Response> get({
|
||||||
|
required Uri url,
|
||||||
|
Map<String, String>? headers,
|
||||||
|
required bool routeOverTor,
|
||||||
|
}) async {
|
||||||
|
if (routeOverTor) {
|
||||||
|
// TODO
|
||||||
|
throw UnimplementedError();
|
||||||
|
} else {
|
||||||
|
return http.get(url, headers: headers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<http.Response> post({
|
||||||
|
required Uri url,
|
||||||
|
Map<String, String>? headers,
|
||||||
|
Object? body,
|
||||||
|
Encoding? encoding,
|
||||||
|
required bool routeOverTor,
|
||||||
|
}) async {
|
||||||
|
if (routeOverTor) {
|
||||||
|
// TODO
|
||||||
|
throw UnimplementedError();
|
||||||
|
} else {
|
||||||
|
return http.post(
|
||||||
|
url,
|
||||||
|
headers: headers,
|
||||||
|
body: body,
|
||||||
|
encoding: encoding,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue