optAuthReq method

Future optAuthReq(
  1. String path, {
  2. String method = "GET",
  3. dynamic body,
  4. Map<String, String>? headers,
  5. Map<String, String>? context,
})

Implementation

Future<dynamic> optAuthReq(String path,
    {String method = "GET",
    dynamic body,
    Map<String, String>? headers,
    Map<String, String>? context}) async {
  try {
    if (headers == null) {
      headers = <String, String>{};
    }
    headers["Authorization"] = "Bearer " + await token();
  } on AtOnlineLoginException {
  } on AtOnlinePlatformException {}
  return req(path,
      method: method, body: body, headers: headers, context: context);
}