headers property

  1. @override
Map<String, String> get headers
inherited

Get the request headers to be sent with this HTTP request.

Implementation

@override
Map<String, String> get headers {
  // If the request has been sent, the headers are effectively frozen.
  // To respect this, an unmodifiable Map is returned.
  if (isSent) return Map<String, String>.unmodifiable(_headers);

  // Otherwise, the underlying case-insensitive Map is returned, which allows
  // modification of the individual headers.
  return _headers;
}
  1. @override
set headers (Map<String, String> headers)
inherited

Set the request headers to send with this HTTP request.

Implementation

@override
set headers(Map<String, String> headers) {
  verifyUnsent();
  _headers = CaseInsensitiveMap<String>.from(headers);
}