@@ -15,6 +15,8 @@ class SignatureTestSuite: XCTestCase {
15
15
( " testGetUnreserved " , testGetUnreserved) ,
16
16
( " testGetUTF8 " , testGetUTF8) ,
17
17
( " testGetVanilla " , testGetVanilla) ,
18
+ ( " testGetVanillaQuery " , testGetVanillaQuery) ,
19
+ ( " testGetVanillaEmptyQueryKey " , testGetVanillaEmptyQueryKey) ,
18
20
( " testPostVanilla " , testPostVanilla) ,
19
21
( " testPostVanillaQuery " , testPostVanillaQuery) ,
20
22
( " testPostVanillaQueryNonunreserved " , testPostVanillaQueryNonunreserved)
@@ -84,6 +86,44 @@ class SignatureTestSuite: XCTestCase {
84
86
)
85
87
}
86
88
89
+ //duplicate as `testGetVanilla`, but is in Amazon Test Suite
90
+ //will keep until I figure out why there's a duplicate test
91
+ func testGetVanillaQuery( ) {
92
+ let expectedCanonicalRequest = " GET \n / \n \n host:example.amazonaws.com \n x-amz-date:20150830T123600Z \n \n host;x-amz-date \n e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 "
93
+
94
+ let expectedCredentialScope = " 20150830/us-east-1/service/aws4_request "
95
+
96
+ let expectedCanonicalHeaders : [ HeaderKey : String ] = [
97
+ " X-Amz-Date " : " 20150830T123600Z " ,
98
+ " Authorization " : " AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5fa00fa31553b73ebf1942676e86291e8372ff2a2260956d9b8aae1d763fbf31 "
99
+ ]
100
+
101
+ let result = sign ( method: . get, path: " / " )
102
+ result. expect (
103
+ canonicalRequest: expectedCanonicalRequest,
104
+ credentialScope: expectedCredentialScope,
105
+ canonicalHeaders: expectedCanonicalHeaders
106
+ )
107
+ }
108
+
109
+ func testGetVanillaEmptyQueryKey( ) {
110
+ let expectedCanonicalRequest = " GET \n / \n Param1=value1 \n host:example.amazonaws.com \n x-amz-date:20150830T123600Z \n \n host;x-amz-date \n e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 "
111
+
112
+ let expectedCredentialScope = " 20150830/us-east-1/service/aws4_request "
113
+
114
+ let expectedCanonicalHeaders : [ HeaderKey : String ] = [
115
+ " X-Amz-Date " : " 20150830T123600Z " ,
116
+ " Authorization " : " AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=a67d582fa61cc504c4bae71f336f98b97f1ea3c7a6bfe1b6e45aec72011b9aeb "
117
+ ]
118
+
119
+ let result = sign ( method: . get, path: " / " , requestParam: " Param1=value1 " )
120
+ result. expect (
121
+ canonicalRequest: expectedCanonicalRequest,
122
+ credentialScope: expectedCredentialScope,
123
+ canonicalHeaders: expectedCanonicalHeaders
124
+ )
125
+ }
126
+
87
127
func testPostVanilla( ) {
88
128
let expectedCanonicalRequest = " POST \n / \n \n host:example.amazonaws.com \n x-amz-date:20150830T123600Z \n \n host;x-amz-date \n e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 "
89
129
0 commit comments