simplified code across the app and consolidated duplicated helpers
This commit is contained in:
@@ -13,10 +13,13 @@ class NextcloudOcs {
|
||||
static Map<String, dynamic> decode(String raw) =>
|
||||
(jsonDecode(raw) as Map<String, dynamic>)['ocs'] as Map<String, dynamic>;
|
||||
|
||||
static Map<String, String> headers() => {
|
||||
/// [authorization] overrides the active session's credentials, which are
|
||||
/// then not required.
|
||||
static Map<String, String> headers({String? authorization}) => {
|
||||
'Accept': 'application/json',
|
||||
'OCS-APIRequest': 'true',
|
||||
'Authorization': SessionManager().requireNextcloud().basicAuthHeader,
|
||||
'Authorization':
|
||||
authorization ?? SessionManager().requireNextcloud().basicAuthHeader,
|
||||
};
|
||||
|
||||
static Uri uri(String pathSuffix, {Map<String, dynamic>? queryParameters}) {
|
||||
|
||||
Reference in New Issue
Block a user