diff --git a/lib/networking/http.dart b/lib/networking/http.dart new file mode 100644 index 000000000..ddda3e7e6 --- /dev/null +++ b/lib/networking/http.dart @@ -0,0 +1,40 @@ +import 'dart:convert'; + +import 'package:http/http.dart' as http; + +// WIP wrapper layer + +abstract class HTTP { + static Future get({ + required Uri url, + Map? headers, + required bool routeOverTor, + }) async { + if (routeOverTor) { + // TODO + throw UnimplementedError(); + } else { + return http.get(url, headers: headers); + } + } + + static Future post({ + required Uri url, + Map? 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, + ); + } + } +}