From f0b5cb44efd26152c7323b393e8712ab0df04bd4 Mon Sep 17 00:00:00 2001 From: Erik Terwan Date: Thu, 18 Apr 2019 15:55:49 +0200 Subject: [PATCH] Removed the content length as this is a possible cause of the 'The provided 'x-amz-content-sha256' header does not match what was computed.' error (checkout https://github.com/aws/aws-sdk-go/issues/148#issuecomment-87506337 ) --- Sources/S3Signer/S3Signer+Private.swift | 1 - Tests/S3Tests/S3SignerAWSTests.swift | 2 -- 2 files changed, 3 deletions(-) diff --git a/Sources/S3Signer/S3Signer+Private.swift b/Sources/S3Signer/S3Signer+Private.swift index 48db4bb..c92e9c8 100755 --- a/Sources/S3Signer/S3Signer+Private.swift +++ b/Sources/S3Signer/S3Signer+Private.swift @@ -148,7 +148,6 @@ extension S3Signer { } if httpMethod == .PUT || httpMethod == .DELETE { - updatedHeaders["content-length"] = payload.size() if httpMethod == .PUT && url.pathExtension != "" { updatedHeaders["content-type"] = (MediaType.fileExtension(url.pathExtension) ?? .plainText).description } diff --git a/Tests/S3Tests/S3SignerAWSTests.swift b/Tests/S3Tests/S3SignerAWSTests.swift index 2774894..43eb95d 100644 --- a/Tests/S3Tests/S3SignerAWSTests.swift +++ b/Tests/S3Tests/S3SignerAWSTests.swift @@ -96,9 +96,7 @@ class S3SignerAWSTests: BaseTestCase { payload: .bytes(randomBytesMessage), dates: overridenDate) - XCTAssertNotNil(headers["Content-Length"].first) XCTAssertNotNil(headers["Content-Type"].first) - XCTAssertEqual(headers["Content-Length"].first, Payload.bytes(randomBytesMessage).size()) XCTAssertEqual(headers["Content-Type"].first, "text/plain") }