mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-25 12:59:24 +00:00
40 lines
788 B
Dart
40 lines
788 B
Dart
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,
|
|
);
|
|
}
|
|
}
|
|
}
|