post method

Future<String> post({
  1. required String url,
  2. required Map<String, String> headers,
  3. required String body,
  4. required Client? httpClient,
})

run executable telegram bot api

Implementation

Future<String> post({
  required String url,
  required Map<String, String> headers,
  required String body,
  required http.Client? httpClient,
}) async {
  httpClient ??= http_client;
  var uri = Uri.parse(url);
  headers["cookie"] = cookies;
  final response = await httpClient.post(uri, headers: headers, body: body);

  var cookiesInfo = response.headers["set-cookie"]?.split(';');
  if (cookiesInfo != null) {
    cookies = addCookiesFromCookiesInfo(cookies, cookiesInfo);
  }
  return response.body;
}