finalizeHeaders method
Finalize the request headers, in particular the content-length and content-type headers since they depend on the request body. The returned map should be unmodifiable.
Implementation
Map<String, String> finalizeHeaders() {
if (contentLength != null) {
headers['content-length'] = contentLength.toString();
}
headers['content-type'] = contentType.toString();
return Map<String, String>.unmodifiable(headers);
}