|
23 | 23 | import java.io.OutputStreamWriter; |
24 | 24 | import java.net.*; |
25 | 25 | import java.security.cert.X509Certificate; |
26 | | -import java.util.Arrays; |
27 | | -import java.util.Collections; |
28 | 26 | import java.util.HashMap; |
29 | | -import java.util.HashSet; |
30 | 27 | import java.util.List; |
31 | 28 | import java.util.Map; |
32 | 29 | import java.util.Map.Entry; |
33 | 30 | import java.util.Objects; |
34 | | -import java.util.stream.Collectors; |
35 | | -import java.util.Set; |
36 | 31 |
|
37 | 32 | /** |
38 | 33 | * The {@code HttpService} class represents a generic HTTP service at a given |
@@ -85,13 +80,6 @@ public boolean verify(String s, SSLSession sslSession) { |
85 | 80 |
|
86 | 81 | private String prefix = null; |
87 | 82 |
|
88 | | - private static final Set<String> filtertHttpHeaderKeys = Collections.unmodifiableSet( |
89 | | - new HashSet<String>(Arrays.asList( |
90 | | - "User-Agent", |
91 | | - "Accept" |
92 | | - )) |
93 | | - ); |
94 | | - |
95 | 83 | static Map<String, String> defaultHeader = new HashMap<String, String>() {{ |
96 | 84 | put("User-Agent", "splunk-sdk-java/1.7.1"); |
97 | 85 | put("Accept", "*/*"); |
@@ -215,12 +203,8 @@ public int getPort() { |
215 | 203 | * @param headers |
216 | 204 | */ |
217 | 205 | public void setCustomHeaders(Map<String, String> headers) { |
218 | | - if (Objects.nonNull(headers) && !headers.isEmpty()) { |
219 | | - Map<String, String> fitleredCustomHeaders = headers.entrySet() |
220 | | - .stream() |
221 | | - .filter(e -> !filtertHttpHeaderKeys.contains(e.getKey())) |
222 | | - .collect(Collectors.toMap(map -> map.getKey(), map -> map.getValue())); |
223 | | - customHeaders.putAll(fitleredCustomHeaders); |
| 206 | + if (Objects.nonNull(headers)) { |
| 207 | + customHeaders = headers; |
224 | 208 | } |
225 | 209 | } |
226 | 210 |
|
|
0 commit comments