postUri method

Future<String> postUri(
  1. Uri url,
  2. Object body, {
  3. Map<String, String> headers = const {},
  4. bool readCache = true,
  5. bool writeCache = true,
  6. Duration? ttl,
  7. String defaultCharset(
    1. List<int>
    )?,
  8. String forcedCharset(
    1. List<int>
    )?,
})

Implementation

Future<String> postUri(
  Uri url,
  Object body, {
  Map<String, String> headers = const {},
  bool readCache = true,
  bool writeCache = true,
  Duration? ttl,
  String Function(List<int>)? defaultCharset,
  String Function(List<int>)? forcedCharset,
}) async {
  final cachedResp = readCache ? getPostCache(url, body, headers) : null;
  if (cachedResp != null) return cachedResp;
  final req = await _client.postUrl(url);
  headers.forEach(req.headers.set);
  return _finishRequest(req..writeln(body), writeCache, defaultCharset,
      forcedCharset, (r) => setPostCache(url, body, headers, r, ttl));
}