postSync method

Future<T> postSync({
  1. required TGPostRequest request,
})

Implementation

Future<T> postSync({required TGPostRequest request}) async {
  try {
    Uri uri = Uri.parse(request.getUrl());
    TGLog.t("POST", uri);
    TGRequestContent content =
        TGRequestContent(request.body(), request.headers());
    final httpRes = await _getClient(request.getUri(), "POST").post(
      uri,
      body: content.body,
      headers: content.headers,
    );
    return Future.value(_prepareResponse(httpRes));
  } catch (error) {
    T t = _populateExceptionResponse(error);
    return Future.value(t);
  }
}