Convert headers to a map. @return the map of headers
()
| 141 | * @return the map of headers |
| 142 | */ |
| 143 | public Map<String,String> toMap() { |
| 144 | if (count == 0) { |
| 145 | return Collections.emptyMap(); |
| 146 | } |
| 147 | Map<String,String> result = new HashMap<>(); |
| 148 | |
| 149 | for (int i = 0; i < count; i++) { |
| 150 | String name = headers[i].getName().toStringType(); |
| 151 | String value = headers[i].getValue().toStringType(); |
| 152 | result.merge(name, value, StringUtils::join); |
| 153 | } |
| 154 | return result; |
| 155 | } |
| 156 | |
| 157 | |
| 158 | /** |
no test coverage detected