Map _adjustErrorHeaders()

in lib/src/response.dart [281:292]


Map<String, Object> _adjustErrorHeaders(
    Map<String, /* String | List<String> */ Object>? headers) {
  if (headers == null || headers['content-type'] == null) {
    return addHeader(headers, 'content-type', 'text/plain');
  }

  final contentTypeValue =
      expandHeaderValue(headers['content-type']!).join(',');
  var contentType =
      MediaType.parse(contentTypeValue).change(mimeType: 'text/plain');
  return addHeader(headers, 'content-type', contentType.toString());
}