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

Commit 86fc6eb

Browse files
committed
Get vanilla query UTF-8.
1 parent 7ce7269 commit 86fc6eb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Tests/AWSTests/SignatureTestSuite.swift

+20
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class SignatureTestSuite: XCTestCase {
1717
("testGetVanilla", testGetVanilla),
1818
("testGetVanillaQuery", testGetVanillaQuery),
1919
("testGetVanillaEmptyQueryKey", testGetVanillaEmptyQueryKey),
20+
("testGetVanillaQueryUnreserved", testGetVanillaQueryUnreserved),
21+
("testGetVanillaQueryUTF8", testGetVanillaQueryUTF8),
2022
("testPostVanilla", testPostVanilla),
2123
("testPostVanillaQuery", testPostVanillaQuery),
2224
("testPostVanillaQueryNonunreserved", testPostVanillaQueryNonunreserved)
@@ -146,6 +148,24 @@ class SignatureTestSuite: XCTestCase {
146148
)
147149
}
148150

151+
func testGetVanillaQueryUTF8() {
152+
let expectedCanonicalRequest = "GET\n/\n%E1%88%B4=bar\nhost:example.amazonaws.com\nx-amz-date:20150830T123600Z\n\nhost;x-amz-date\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
153+
154+
let expectedCredentialScope = "20150830/us-east-1/service/aws4_request"
155+
156+
let expectedCanonicalHeaders: [HeaderKey : String] = [
157+
"X-Amz-Date": "20150830T123600Z",
158+
"Authorization": "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=2cdec8eed098649ff3a119c94853b13c643bcf08f8b0a1d91e12c9027818dd04"
159+
]
160+
161+
let result = sign(method: .get, path: "/", requestParam: "ሴ=bar")
162+
result.expect(
163+
canonicalRequest: expectedCanonicalRequest,
164+
credentialScope: expectedCredentialScope,
165+
canonicalHeaders: expectedCanonicalHeaders
166+
)
167+
}
168+
149169
func testPostVanilla() {
150170
let expectedCanonicalRequest = "POST\n/\n\nhost:example.amazonaws.com\nx-amz-date:20150830T123600Z\n\nhost;x-amz-date\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
151171

0 commit comments

Comments
 (0)