get static method
- String url, {
- PodContentType accept = PodContentType.any,
Perform a GET request to fetch a resource.
Implementation
static Future<PodResponse> get(
String url, {
PodContentType accept = PodContentType.any,
}) async {
try {
final tokens = await PodAuth.getTokens(url, 'GET');
final response = await http.get(
Uri.parse(url),
headers: {
'Accept': accept.value,
'Authorization': 'DPoP ${tokens.accessToken}',
'Connection': 'keep-alive',
'DPoP': tokens.dPopToken,
},
);
return PodResponse(
statusCode: response.statusCode,
body: response.body,
headers: response.headers,
);
} catch (e) {
debugPrint('PodHttp.get() error: $e');
rethrow;
}
}