File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed
Sources/ClientRuntime/Networking Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public enum HashFunction {
2828 default : return nil
2929 }
3030 }
31-
31+
3232 static func fromList( _ stringArray: [ String ] ) -> [ HashFunction ] {
3333 var hashFunctions = [ HashFunction] ( )
3434 for string in stringArray {
@@ -39,7 +39,7 @@ public enum HashFunction {
3939
4040 return hashFunctions
4141 }
42-
42+
4343 func toString( ) -> String {
4444 switch self {
4545 case . crc32: return " crc32 "
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public struct ContentMD5Middleware<OperationStackOutput>: Middleware {
1919 Self. Context == H . Context {
2020
2121 // Skip MD5 hash if using checksums
22- if ( input. headers. exists ( name: " x-amz-sdk-checksum-algorithm " ) ) {
22+ if input. headers. exists ( name: " x-amz-sdk-checksum-algorithm " ) {
2323 return try await next. handle ( context: context, input: input)
2424 }
2525
Original file line number Diff line number Diff line change @@ -72,15 +72,15 @@ public struct FlexibleChecksumsResponseMiddleware<OperationStackOutput>: Middlew
7272 }
7373
7474 func handleNormalPayload( _ data: Data ? ) throws {
75-
75+
7676 guard let data else {
7777 throw ClientError . dataNotFound ( " Cannot calculate checksum of empty body! " )
7878 }
79-
79+
8080 let calculatedChecksum = try responseChecksum. computeHash ( of: data)
81-
81+
8282 let actualChecksum = calculatedChecksum. toBase64String ( )
83-
83+
8484 if expectedChecksum != actualChecksum {
8585 throw ChecksumMismatchException . message (
8686 " Checksum mismatch. Expected \( expectedChecksum) but was \( actualChecksum) "
@@ -91,7 +91,7 @@ public struct FlexibleChecksumsResponseMiddleware<OperationStackOutput>: Middlew
9191 func handleStreamPayload( _ stream: Stream ) throws {
9292 return
9393 }
94-
94+
9595 // Handle body vs handle stream
9696 switch response. httpResponse. body {
9797 case . data( let data) :
@@ -101,7 +101,7 @@ public struct FlexibleChecksumsResponseMiddleware<OperationStackOutput>: Middlew
101101 case . noStream:
102102 throw ClientError . dataNotFound ( " Cannot calculate the checksum of an empty body! " )
103103 }
104-
104+
105105 return try await next. handle ( context: context, input: input)
106106 }
107107
You can’t perform that action at this time.
0 commit comments