WIP: sample stub for possible tor integration

This commit is contained in:
julian 2023-04-27 16:35:16 -06:00
parent 05dc2a23e6
commit e940ad8e71

40
lib/networking/http.dart Normal file
View 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,
);
}
}
}