@@ -136,15 +136,14 @@ public static Map<String, String> encryptionHeadersFrom(HttpHeaders headers) {
136
136
private static Map <String , String > parseHeadersToMap (HttpHeaders headers ,
137
137
Predicate <String > matcher ) {
138
138
return headers
139
- .entrySet ()
139
+ .headerSet ()
140
140
.stream ()
141
141
.map (
142
142
entry -> {
143
143
if (matcher .test (entry .getKey ())
144
- && entry .getValue () != null
145
144
&& !entry .getValue ().isEmpty ()
146
- && isNotBlank (entry .getValue ().get ( 0 ))) {
147
- return new SimpleEntry <>(entry .getKey (), entry .getValue ().get ( 0 ));
145
+ && isNotBlank (entry .getValue ().getFirst ( ))) {
146
+ return new SimpleEntry <>(entry .getKey (), entry .getValue ().getFirst ( ));
148
147
} else {
149
148
return null ;
150
149
}
@@ -227,17 +226,17 @@ public static Map<String, String> checksumHeaderFrom(
227
226
228
227
@ Nullable
229
228
public static ChecksumAlgorithm checksumAlgorithmFromHeader (HttpHeaders headers ) {
230
- if (headers .containsKey (X_AMZ_CHECKSUM_SHA256 )) {
229
+ if (headers .containsHeader (X_AMZ_CHECKSUM_SHA256 )) {
231
230
return ChecksumAlgorithm .SHA256 ;
232
- } else if (headers .containsKey (X_AMZ_CHECKSUM_SHA1 )) {
231
+ } else if (headers .containsHeader (X_AMZ_CHECKSUM_SHA1 )) {
233
232
return ChecksumAlgorithm .SHA1 ;
234
- } else if (headers .containsKey (X_AMZ_CHECKSUM_CRC32 )) {
233
+ } else if (headers .containsHeader (X_AMZ_CHECKSUM_CRC32 )) {
235
234
return ChecksumAlgorithm .CRC32 ;
236
- } else if (headers .containsKey (X_AMZ_CHECKSUM_CRC32C )) {
235
+ } else if (headers .containsHeader (X_AMZ_CHECKSUM_CRC32C )) {
237
236
return ChecksumAlgorithm .CRC32C ;
238
- } else if (headers .containsKey (X_AMZ_CHECKSUM_CRC64NVME )) {
237
+ } else if (headers .containsHeader (X_AMZ_CHECKSUM_CRC64NVME )) {
239
238
return ChecksumAlgorithm .CRC64NVME ;
240
- } else if (headers .containsKey (X_AMZ_CHECKSUM_ALGORITHM )) {
239
+ } else if (headers .containsHeader (X_AMZ_CHECKSUM_ALGORITHM )) {
241
240
var checksumAlgorithm = headers .getFirst (X_AMZ_CHECKSUM_ALGORITHM );
242
241
return ChecksumAlgorithm .fromString (checksumAlgorithm );
243
242
} else {
@@ -247,7 +246,7 @@ public static ChecksumAlgorithm checksumAlgorithmFromHeader(HttpHeaders headers)
247
246
248
247
@ Nullable
249
248
public static ChecksumAlgorithm checksumAlgorithmFromSdk (HttpHeaders headers ) {
250
- if (headers .containsKey (X_AMZ_SDK_CHECKSUM_ALGORITHM )) {
249
+ if (headers .containsHeader (X_AMZ_SDK_CHECKSUM_ALGORITHM )) {
251
250
return ChecksumAlgorithm .fromString (headers .getFirst (X_AMZ_SDK_CHECKSUM_ALGORITHM ));
252
251
} else {
253
252
return null ;
@@ -256,15 +255,15 @@ public static ChecksumAlgorithm checksumAlgorithmFromSdk(HttpHeaders headers) {
256
255
257
256
@ Nullable
258
257
public static String checksumFrom (HttpHeaders headers ) {
259
- if (headers .containsKey (X_AMZ_CHECKSUM_SHA256 )) {
258
+ if (headers .containsHeader (X_AMZ_CHECKSUM_SHA256 )) {
260
259
return headers .getFirst (X_AMZ_CHECKSUM_SHA256 );
261
- } else if (headers .containsKey (X_AMZ_CHECKSUM_SHA1 )) {
260
+ } else if (headers .containsHeader (X_AMZ_CHECKSUM_SHA1 )) {
262
261
return headers .getFirst (X_AMZ_CHECKSUM_SHA1 );
263
- } else if (headers .containsKey (X_AMZ_CHECKSUM_CRC32 )) {
262
+ } else if (headers .containsHeader (X_AMZ_CHECKSUM_CRC32 )) {
264
263
return headers .getFirst (X_AMZ_CHECKSUM_CRC32 );
265
- } else if (headers .containsKey (X_AMZ_CHECKSUM_CRC32C )) {
264
+ } else if (headers .containsHeader (X_AMZ_CHECKSUM_CRC32C )) {
266
265
return headers .getFirst (X_AMZ_CHECKSUM_CRC32C );
267
- } else if (headers .containsKey (X_AMZ_CHECKSUM_CRC64NVME )) {
266
+ } else if (headers .containsHeader (X_AMZ_CHECKSUM_CRC64NVME )) {
268
267
return headers .getFirst (X_AMZ_CHECKSUM_CRC64NVME );
269
268
}
270
269
return null ;
0 commit comments