Skip to content
This repository was archived by the owner on Apr 20, 2024. It is now read-only.

Commit 6dfcbae

Browse files
committed
Get vanilla.
1 parent db63b55 commit 6dfcbae

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Tests/AWSTests/SignatureTestSuite.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class SignatureTestSuite: XCTestCase {
1414
static var allTests = [
1515
("testGetUnreserved", testGetUnreserved),
1616
("testGetUTF8", testGetUTF8),
17+
("testGetVanilla", testGetVanilla),
1718
("testPostVanilla", testPostVanilla),
1819
("testPostVanillaQuery", testPostVanillaQuery),
1920
("testPostVanillaQueryNonunreserved", testPostVanillaQueryNonunreserved)
@@ -65,6 +66,24 @@ class SignatureTestSuite: XCTestCase {
6566
)
6667
}
6768

69+
func testGetVanilla() {
70+
let expectedCanonicalRequest = "GET\n/\n\nhost:example.amazonaws.com\nx-amz-date:20150830T123600Z\n\nhost;x-amz-date\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
71+
72+
let expectedCredentialScope = "20150830/us-east-1/service/aws4_request"
73+
74+
let expectedCanonicalHeaders: [HeaderKey : String] = [
75+
"X-Amz-Date": "20150830T123600Z",
76+
"Authorization": "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31"
77+
]
78+
79+
let result = sign(method: .get, path: "/")
80+
result.expect(
81+
canonicalRequest: expectedCanonicalRequest,
82+
credentialScope: expectedCredentialScope,
83+
canonicalHeaders: expectedCanonicalHeaders
84+
)
85+
}
86+
6887
func testPostVanilla() {
6988
let expectedCanonicalRequest = "POST\n/\n\nhost:example.amazonaws.com\nx-amz-date:20150830T123600Z\n\nhost;x-amz-date\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
7089

0 commit comments

Comments
 (0)