toMapList method

Map<String, List<String>> toMapList()

Converts the headers to a map where duplicate headers are represented using a list of values.

Implementation

Map<String, List<String>> toMapList() {
  return switch (this) {
    HttpHeaderMap map => {
        for (final entry in map.map.entries)
          entry.key.httpName: [entry.value],
      },
    HttpHeaderRawMap rawMap => {
        for (final entry in rawMap.map.entries) entry.key: [entry.value],
      },
    HttpHeaderList list => list.list.asHeaderMapList,
  };
}