singleHeader function

String? singleHeader(
  1. HttpHeaders headers,
  2. String name
)

the value of header name, or null when it is missing or sent more than once. HttpHeaders.value throws (a 500) on a repeated header.

Implementation

String? singleHeader(HttpHeaders headers, String name) {
  List<String>? values = headers[name];
  return values != null && values.length == 1 ? values.first : null;
}