@@ -14,6 +14,7 @@ class SignatureTestSuite: XCTestCase {
14
14
static var allTests = [
15
15
( " testGetUnreserved " , testGetUnreserved) ,
16
16
( " testGetUTF8 " , testGetUTF8) ,
17
+ ( " testGetVanilla " , testGetVanilla) ,
17
18
( " testPostVanilla " , testPostVanilla) ,
18
19
( " testPostVanillaQuery " , testPostVanillaQuery) ,
19
20
( " testPostVanillaQueryNonunreserved " , testPostVanillaQueryNonunreserved)
@@ -65,6 +66,24 @@ class SignatureTestSuite: XCTestCase {
65
66
)
66
67
}
67
68
69
+ func testGetVanilla( ) {
70
+ let expectedCanonicalRequest = " GET \n / \n \n host:example.amazonaws.com \n x-amz-date:20150830T123600Z \n \n host;x-amz-date \n e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 "
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
+
68
87
func testPostVanilla( ) {
69
88
let expectedCanonicalRequest = " POST \n / \n \n host:example.amazonaws.com \n x-amz-date:20150830T123600Z \n \n host;x-amz-date \n e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 "
70
89
0 commit comments