From e940ad8e71dd2561379fb208a04ea8e1a3053c9f Mon Sep 17 00:00:00 2001 From: julian Date: Thu, 27 Apr 2023 16:35:16 -0600 Subject: [PATCH] WIP: sample stub for possible tor integration --- lib/networking/http.dart | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lib/networking/http.dart 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, + ); + } + } +}