//
// Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// A copy of the License is located at
//
// http://aws.amazon.com/apache2.0
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//

// ############################################################################
// Auto-generated file. Do not edit this file manually
// ############################################################################

import Foundation
import AWSCore

/// Credentials provider for the various tests. Keys and tokens are hardcoded in the `generate_swift_test_cases` script
struct SigV4TestCredentials {
    static let regionName = "us-east-1"

    // 20150830T123600Z
    static let testDate = Date(timeIntervalSince1970: 1440938160)
    static let expiry: Int32 = 86400

    static let basicTestCredentials = AWSStaticCredentialsProvider(accessKey: "AKIDEXAMPLE",
                                                                   secretKey: "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY")

    static let sessionTestCredentials = AWSBasicSessionCredentialsProvider(accessKey: "AKIDEXAMPLE",
                                                                           secretKey: "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY",
                                                                           sessionToken: "AQoDYXdzEPT//////////wEXAMPLEtc764bNrC9SAPBSM22wDOk4x4HIZ8j4FZTwdQWLWsKWHGBuFqwAeMicRXmxfpSPfIeoIYRqTflfKD8YUuwthAx7mSEI/qkPpKPi/kMcGdQrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d+xo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz+scqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR/oLxBA==")

}

struct SigV4PresignedURLTestCases {
    static let allCases = [


// MARK: - Test Case "get-vanilla-utf8-query"

SigV4TestCase(

testCaseName: "get-vanilla-utf8-query",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET /?%E1%88%B4=bar HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?%E1%88%B4=bar&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=100714066184b71b6bb2ad12da83b0a1937bd278677d3170eb7daa17b74eca28",

canonicalRequest:
"""
GET
/
%E1%88%B4=bar&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
e79799dc9389e904799234983f562a6e76d938404d78efa97ce713ba5291bd05
""",

signature:
"""
100714066184b71b6bb2ad12da83b0a1937bd278677d3170eb7daa17b74eca28
"""
),


// MARK: - Test Case "get-vanilla-query-order-key-case"

SigV4TestCase(

testCaseName: "get-vanilla-query-order-key-case",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET /?Param2=value2&Param1=value1 HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?Param2=value2&Param1=value1&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=b95b3cbdad52a7c3456e03c0fef8240796b8b2016d170b7b78c055a67f516df8",

canonicalRequest:
"""
GET
/
Param1=value1&Param2=value2&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
498c8d97a047f7f969aa910fbdb51e7718840df0a99f26143209fcc599be1cbc
""",

signature:
"""
b95b3cbdad52a7c3456e03c0fef8240796b8b2016d170b7b78c055a67f516df8
"""
),


// MARK: - Test Case "get-header-value-trim"

SigV4TestCase(

testCaseName: "get-header-value-trim",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET / HTTP/1.1
Host:example.amazonaws.com
My-Header1: value1
My-Header2: "a   b   c"
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bmy-header1%3Bmy-header2%3Bx-amz-date&X-Amz-Signature=fad9a97a21823f33f5e77965ab1227e4e120b706fee5258f41bd72db4ebcdb54",

canonicalRequest:
"""
GET
/
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bmy-header1%3Bmy-header2%3Bx-amz-date
host:example.amazonaws.com
my-header1:value1
my-header2:"a b c"
x-amz-date:20150830T123600Z

host;my-header1;my-header2;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
9ebb2e8c17bdfe84745bb35e086fa2d416567e05df3159dd9b297cd68d7fdb22
""",

signature:
"""
fad9a97a21823f33f5e77965ab1227e4e120b706fee5258f41bd72db4ebcdb54
"""
),


// MARK: - Test Case "get-vanilla-query-unreserved"

SigV4TestCase(

testCaseName: "get-vanilla-query-unreserved",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET /?-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=9175c40e763100d99a0091b360f22be3c0e0c8edffe9353b7a8df8f3217e4588",

canonicalRequest:
"""
GET
/
-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
17fd7445f93cc60fa8e802462212f7f99a0bee743e9f27a9132d42968d09ff0f
""",

signature:
"""
9175c40e763100d99a0091b360f22be3c0e0c8edffe9353b7a8df8f3217e4588
"""
),


// MARK: - Test Case "get-vanilla-query-order-key"

SigV4TestCase(

testCaseName: "get-vanilla-query-order-key",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET /?Param1=value2&Param1=Value1 HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?Param1=value2&Param1=Value1&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=dedef9f297faf89b0267dde658b3890d47515e6fcaab744b7d8b4720b67fbea2",

canonicalRequest:
"""
GET
/
Param1=Value1&Param1=value2&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
3c2906771cdb27453e76eb312a5795dbd6608776037d75478bf1ed5108aa91af
""",

signature:
"""
dedef9f297faf89b0267dde658b3890d47515e6fcaab744b7d8b4720b67fbea2
"""
),


// MARK: - Test Case "get-vanilla"

SigV4TestCase(

testCaseName: "get-vanilla",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET / HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=b92f41f31e31097d2079a5b3ffaf9fb0248c76a84287521dd189b32e9df08077",

canonicalRequest:
"""
GET
/
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
e05d937da66337240cd15474a0b913d60b0f88f403d2de9e3d9d5f419fa68fc1
""",

signature:
"""
b92f41f31e31097d2079a5b3ffaf9fb0248c76a84287521dd189b32e9df08077
"""
),


// MARK: - Test Case "post-sts-header-after"

SigV4TestCase(

testCaseName: "post-sts-header-after",

// Given

credentialsProvider: SigV4TestCredentials.sessionTestCredentials,

// When
originalRequest:
"""
POST / HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Security-Token=AQoDYXdzEPT%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEXAMPLEtc764bNrC9SAPBSM22wDOk4x4HIZ8j4FZTwdQWLWsKWHGBuFqwAeMicRXmxfpSPfIeoIYRqTflfKD8YUuwthAx7mSEI%2FqkPpKPi%2FkMcGdQrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d%2Bxo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz%2BscqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR%2FoLxBA%3D%3D&X-Amz-Signature=702070c2bc54d794febfc27b5691bbc43d8c916ea8e6cdd2eeb48828030145e0",

canonicalRequest:
"""
POST
/
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
92ddfa709af30e239a0ed017af5de49406192689dd8287e34b26a0679c6b41b8
""",

signature:
"""
702070c2bc54d794febfc27b5691bbc43d8c916ea8e6cdd2eeb48828030145e0
"""
),


// MARK: - Test Case "post-sts-header-before"

SigV4TestCase(

testCaseName: "post-sts-header-before",

// Given

credentialsProvider: SigV4TestCredentials.sessionTestCredentials,

shouldSignSecurityToken: true,

// When
originalRequest:
"""
POST / HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
X-Amz-Security-Token:AQoDYXdzEPT//////////wEXAMPLEtc764bNrC9SAPBSM22wDOk4x4HIZ8j4FZTwdQWLWsKWHGBuFqwAeMicRXmxfpSPfIeoIYRqTflfKD8YUuwthAx7mSEI/qkPpKPi/kMcGdQrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d+xo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz+scqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR/oLxBA==
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date%3Bx-amz-security-token&X-Amz-Security-Token=AQoDYXdzEPT%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEXAMPLEtc764bNrC9SAPBSM22wDOk4x4HIZ8j4FZTwdQWLWsKWHGBuFqwAeMicRXmxfpSPfIeoIYRqTflfKD8YUuwthAx7mSEI%2FqkPpKPi%2FkMcGdQrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d%2Bxo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz%2BscqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR%2FoLxBA%3D%3D&X-Amz-Signature=1ec135464261b94ab39964bd3339c62e72b9258fb19a2a4d06373977a036056c",

canonicalRequest:
"""
POST
/
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-Security-Token=AQoDYXdzEPT%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEXAMPLEtc764bNrC9SAPBSM22wDOk4x4HIZ8j4FZTwdQWLWsKWHGBuFqwAeMicRXmxfpSPfIeoIYRqTflfKD8YUuwthAx7mSEI%2FqkPpKPi%2FkMcGdQrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d%2Bxo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz%2BscqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR%2FoLxBA%3D%3D&X-Amz-SignedHeaders=host%3Bx-amz-date%3Bx-amz-security-token
host:example.amazonaws.com
x-amz-date:20150830T123600Z
x-amz-security-token:AQoDYXdzEPT//////////wEXAMPLEtc764bNrC9SAPBSM22wDOk4x4HIZ8j4FZTwdQWLWsKWHGBuFqwAeMicRXmxfpSPfIeoIYRqTflfKD8YUuwthAx7mSEI/qkPpKPi/kMcGdQrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d+xo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz+scqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR/oLxBA==

host;x-amz-date;x-amz-security-token
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
1cfcb94ca37b059782393f1b607fa21871a45e5d44f4df29d1e00ca1110bddc1
""",

signature:
"""
1ec135464261b94ab39964bd3339c62e72b9258fb19a2a4d06373977a036056c
"""
),


// MARK: - Test Case "get-unreserved"

SigV4TestCase(

testCaseName: "get-unreserved",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET /-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=43b77075b9bc92a6296cf7ac6b9d781199beae4526897c3cdf2d9647a3b13c47",

canonicalRequest:
"""
GET
/-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
c1edb283e8792becbe1b79f144ed88707ba049b6acfa379053ecdc5337673846
""",

signature:
"""
43b77075b9bc92a6296cf7ac6b9d781199beae4526897c3cdf2d9647a3b13c47
"""
),


// MARK: - Test Case "get-header-value-multiline"

SigV4TestCase(

testCaseName: "get-header-value-multiline",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET / HTTP/1.1
Host:example.amazonaws.com
My-Header1:value1
  value2
     value3
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bmy-header1%3Bx-amz-date&X-Amz-Signature=69bae9a597bc95816efeb37599dc10562264fbe251de4794e5ac9d170f9c50cd",

canonicalRequest:
"""
GET
/
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bmy-header1%3Bx-amz-date
host:example.amazonaws.com
my-header1:value1 value2 value3
x-amz-date:20150830T123600Z

host;my-header1;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
b665e38bb8a24de60542b07413f907e2e6dd2f4feca0c707169f4e4cf9986333
""",

signature:
"""
69bae9a597bc95816efeb37599dc10562264fbe251de4794e5ac9d170f9c50cd
"""
),


// MARK: - Test Case "post-x-www-form-urlencoded-parameters"

SigV4TestCase(

testCaseName: "post-x-www-form-urlencoded-parameters",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
POST / HTTP/1.1
Content-Type:application/x-www-form-urlencoded; charset=utf-8
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
Content-Length:13

Param1=value1
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=content-length%3Bcontent-type%3Bhost%3Bx-amz-date&X-Amz-Signature=9ec22502e002a6ae9d84414a2b6f57df4a82f3bdd2cfcb85b8aa41c7ac9d4b00",

canonicalRequest:
"""
POST
/
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=content-length%3Bcontent-type%3Bhost%3Bx-amz-date
content-length:13
content-type:application/x-www-form-urlencoded; charset=utf-8
host:example.amazonaws.com
x-amz-date:20150830T123600Z

content-length;content-type;host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
f6407277c96b15a57ef79fa7eee9f8b2fa2540acec7e49331c7191ce2215e3f6
""",

signature:
"""
9ec22502e002a6ae9d84414a2b6f57df4a82f3bdd2cfcb85b8aa41c7ac9d4b00
"""
),


// MARK: - Test Case "post-vanilla"

SigV4TestCase(

testCaseName: "post-vanilla",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
POST / HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=702070c2bc54d794febfc27b5691bbc43d8c916ea8e6cdd2eeb48828030145e0",

canonicalRequest:
"""
POST
/
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
92ddfa709af30e239a0ed017af5de49406192689dd8287e34b26a0679c6b41b8
""",

signature:
"""
702070c2bc54d794febfc27b5691bbc43d8c916ea8e6cdd2eeb48828030145e0
"""
),


// MARK: - Test Case "post-x-www-form-urlencoded"

SigV4TestCase(

testCaseName: "post-x-www-form-urlencoded",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
POST / HTTP/1.1
Content-Type:application/x-www-form-urlencoded
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
Content-Length:13

Param1=value1
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=content-length%3Bcontent-type%3Bhost%3Bx-amz-date&X-Amz-Signature=69e59304cf61237c79d4f0c20b02f9bacd2788ef13005119e11c91b7f4683f8c",

canonicalRequest:
"""
POST
/
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=content-length%3Bcontent-type%3Bhost%3Bx-amz-date
content-length:13
content-type:application/x-www-form-urlencoded
host:example.amazonaws.com
x-amz-date:20150830T123600Z

content-length;content-type;host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
3517f5b1516bf11ace6f1e858b9daa61d77134cc23293d6d290a94771e499e26
""",

signature:
"""
69e59304cf61237c79d4f0c20b02f9bacd2788ef13005119e11c91b7f4683f8c
"""
),


// MARK: - Test Case "post-header-key-case"

SigV4TestCase(

testCaseName: "post-header-key-case",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
POST / HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=702070c2bc54d794febfc27b5691bbc43d8c916ea8e6cdd2eeb48828030145e0",

canonicalRequest:
"""
POST
/
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
92ddfa709af30e239a0ed017af5de49406192689dd8287e34b26a0679c6b41b8
""",

signature:
"""
702070c2bc54d794febfc27b5691bbc43d8c916ea8e6cdd2eeb48828030145e0
"""
),


// MARK: - Test Case "get-vanilla-empty-query-key"

SigV4TestCase(

testCaseName: "get-vanilla-empty-query-key",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET /?Param1=value1 HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?Param1=value1&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=e6e471dbfc10fc73772bc4608a88cd405c6767b6e339f6a5a181c6d3de70be87",

canonicalRequest:
"""
GET
/
Param1=value1&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
fd83f4e88674ace574c23aa8dcf3ed11c30760df0413a78727db4d03d8a4c195
""",

signature:
"""
e6e471dbfc10fc73772bc4608a88cd405c6767b6e339f6a5a181c6d3de70be87
"""
),


// MARK: - Test Case "post-header-key-sort"

SigV4TestCase(

testCaseName: "post-header-key-sort",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
POST / HTTP/1.1
Host:example.amazonaws.com
My-Header1:value1
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bmy-header1%3Bx-amz-date&X-Amz-Signature=4c4d2e0b38fe4b6a083d4e90bafe7d6c147842f8f4020ca0f2802aac9f6092c6",

canonicalRequest:
"""
POST
/
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bmy-header1%3Bx-amz-date
host:example.amazonaws.com
my-header1:value1
x-amz-date:20150830T123600Z

host;my-header1;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
9137fad68dc0b678d02ec751ddcd18359ec788a82ebddee014dd8f3bc06175cf
""",

signature:
"""
4c4d2e0b38fe4b6a083d4e90bafe7d6c147842f8f4020ca0f2802aac9f6092c6
"""
),


// MARK: - Test Case "aws-mobile-sdk-get-s3-sample"

SigV4TestCase(

testCaseName: "aws-mobile-sdk-get-s3-sample",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET /test.txt HTTP/1.1
Host:examplebucket.s3.amazonaws.com
""",

// Then
expectedPresignedURL: "https://examplebucket.s3.amazonaws.com/test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=6ba175ef28601c29d857ab02d5b8c165382c7967d143e3998ddf268d157e69a7",

canonicalRequest:
"""
GET
/test.txt
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host
host:examplebucket.s3.amazonaws.com

host
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
8c4631a3c390c6592d07b7964d90d1594610e142fedd8d59195359a2f40656b5
""",

signature:
"""
6ba175ef28601c29d857ab02d5b8c165382c7967d143e3998ddf268d157e69a7
"""
),


// MARK: - Test Case "post-vanilla-empty-query-value"

SigV4TestCase(

testCaseName: "post-vanilla-empty-query-value",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
POST /?Param1=value1 HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?Param1=value1&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=de5e9df474604081e4a8145cbee7da55dee3544f9b5a9bbb5ef2e78ab222c1d0",

canonicalRequest:
"""
POST
/
Param1=value1&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
7e331b0cfb8d054c83e3919fd0429dc4157972b893f57f85d2fd0821c766358c
""",

signature:
"""
de5e9df474604081e4a8145cbee7da55dee3544f9b5a9bbb5ef2e78ab222c1d0
"""
),


// MARK: - Test Case "get-vanilla-query"

SigV4TestCase(

testCaseName: "get-vanilla-query",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET / HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=b92f41f31e31097d2079a5b3ffaf9fb0248c76a84287521dd189b32e9df08077",

canonicalRequest:
"""
GET
/
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
e05d937da66337240cd15474a0b913d60b0f88f403d2de9e3d9d5f419fa68fc1
""",

signature:
"""
b92f41f31e31097d2079a5b3ffaf9fb0248c76a84287521dd189b32e9df08077
"""
),


// MARK: - Test Case "get-header-value-order"

SigV4TestCase(

testCaseName: "get-header-value-order",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET / HTTP/1.1
Host:example.amazonaws.com
My-Header1:value4
My-Header1:value1
My-Header1:value3
My-Header1:value2
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bmy-header1%3Bx-amz-date&X-Amz-Signature=e8dac04aea31d53401ba5041896ed4ba404b0b3ac404e7cb5f7e1a9095f483cf",

canonicalRequest:
"""
GET
/
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bmy-header1%3Bx-amz-date
host:example.amazonaws.com
my-header1:value2
x-amz-date:20150830T123600Z

host;my-header1;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
168d806b614a89e675a196085ded4e4019da0b52aaf431a51b09eacb3b9d2200
""",

signature:
"""
e8dac04aea31d53401ba5041896ed4ba404b0b3ac404e7cb5f7e1a9095f483cf
"""
),


// MARK: - Test Case "post-vanilla-query"

SigV4TestCase(

testCaseName: "post-vanilla-query",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
POST /?Param1=value1 HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?Param1=value1&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=de5e9df474604081e4a8145cbee7da55dee3544f9b5a9bbb5ef2e78ab222c1d0",

canonicalRequest:
"""
POST
/
Param1=value1&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
7e331b0cfb8d054c83e3919fd0429dc4157972b893f57f85d2fd0821c766358c
""",

signature:
"""
de5e9df474604081e4a8145cbee7da55dee3544f9b5a9bbb5ef2e78ab222c1d0
"""
),


// MARK: - Test Case "get-vanilla-query-order-value"

SigV4TestCase(

testCaseName: "get-vanilla-query-order-value",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET /?Param1=value2&Param1=value1 HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?Param1=value2&Param1=value1&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=57947a1745cd6cc9a191c8d9126cf7d387113374f54f3999ff5569bbf88146ff",

canonicalRequest:
"""
GET
/
Param1=value1&Param1=value2&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
e62675cc9f8d427a4ba28c09154dae384369c70718c9dd8b1853ec661068ab07
""",

signature:
"""
57947a1745cd6cc9a191c8d9126cf7d387113374f54f3999ff5569bbf88146ff
"""
),


// MARK: - Test Case "post-header-value-case"

SigV4TestCase(

testCaseName: "post-header-value-case",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
POST / HTTP/1.1
Host:example.amazonaws.com
My-Header1:VALUE1
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bmy-header1%3Bx-amz-date&X-Amz-Signature=ef9ae353fb9e72d4921930e8294664165dfb482ceb4db575a59c1e10aba73772",

canonicalRequest:
"""
POST
/
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bmy-header1%3Bx-amz-date
host:example.amazonaws.com
my-header1:VALUE1
x-amz-date:20150830T123600Z

host;my-header1;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
eef0a61529773600104f2032634137666b6ca736dbb8ca533e7061e6e61a6fa4
""",

signature:
"""
ef9ae353fb9e72d4921930e8294664165dfb482ceb4db575a59c1e10aba73772
"""
),


// MARK: - Test Case "get-slash"

SigV4TestCase(

testCaseName: "get-slash",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET // HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com//?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=36d570f6da55de7197cc6d669ddf8f9490035dfc4a23200ec042b7c73285e2e9",

canonicalRequest:
"""
GET
//
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
6246ea5cfbb72de614580f025d0e2b7073918ee8bfe5e07ac6452bd17303e582
""",

signature:
"""
36d570f6da55de7197cc6d669ddf8f9490035dfc4a23200ec042b7c73285e2e9
"""
),


// MARK: - Test Case "get-slashes"

SigV4TestCase(

testCaseName: "get-slashes",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET //example// HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com//example//?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=400adfd11bfb12a6702db9837b40a8bf6d30c8cb27c8ded4ac37aa9364449b12",

canonicalRequest:
"""
GET
//example//
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
6490cd94b7fe9abc00eaec7b39d5dcd1f73c5bc8cfe024a87846128748dba03b
""",

signature:
"""
400adfd11bfb12a6702db9837b40a8bf6d30c8cb27c8ded4ac37aa9364449b12
"""
),


// MARK: - Test Case "get-relative"

SigV4TestCase(

testCaseName: "get-relative",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET /example/.. HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/example/..?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=da7925d4e2faeaf29ea639c9699c56a5d38e89de54b5a67b9ee1b408b48cb9fe",

canonicalRequest:
"""
GET
/example/..
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
0fd37d9348c48c5df87912ffb8fc4fe077bdc7fd37702920ccb44695070e2b2e
""",

signature:
"""
da7925d4e2faeaf29ea639c9699c56a5d38e89de54b5a67b9ee1b408b48cb9fe
"""
),


// MARK: - Test Case "get-slash-pointless-dot"

SigV4TestCase(

testCaseName: "get-slash-pointless-dot",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET /./example HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/./example?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=a4aabecdf560012e16ab05bccbaca97006ee84bfb9615982f5650e816cac5f91",

canonicalRequest:
"""
GET
/./example
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
c8118cbeeedf4aa038ca59120e09fcdefe9edec4602a70b751d9c290859b893e
""",

signature:
"""
a4aabecdf560012e16ab05bccbaca97006ee84bfb9615982f5650e816cac5f91
"""
),


// MARK: - Test Case "get-slash-dot-slash"

SigV4TestCase(

testCaseName: "get-slash-dot-slash",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET /./ HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/./?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=2f637db15a384845e6eba74baec4fa0c880f3cdf2de66c16c5e31012cc65ee1e",

canonicalRequest:
"""
GET
/./
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
f0b867c5167e66f1dda99dcc567d9b9f4a0772d07f6928736571b554a8b9d5e8
""",

signature:
"""
2f637db15a384845e6eba74baec4fa0c880f3cdf2de66c16c5e31012cc65ee1e
"""
),


// MARK: - Test Case "get-relative-relative"

SigV4TestCase(

testCaseName: "get-relative-relative",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET /example1/example2/../.. HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/example1/example2/../..?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=a10013154ff0535d3d65ea5822c21e28f5821411d345abf9bc8b60f4b8753cba",

canonicalRequest:
"""
GET
/example1/example2/../..
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
75784ebb671cb836e3fbc9a5e26ec254490e415d2e4f6b87fb6f05bded6819e5
""",

signature:
"""
a10013154ff0535d3d65ea5822c21e28f5821411d345abf9bc8b60f4b8753cba
"""
),


// MARK: - Test Case "get-header-key-duplicate"

SigV4TestCase(

testCaseName: "get-header-key-duplicate",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

// When
originalRequest:
"""
GET / HTTP/1.1
Host:example.amazonaws.com
My-Header1:value2
My-Header1:value2
My-Header1:value1
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bmy-header1%3Bx-amz-date&X-Amz-Signature=85e97ffeac044f345cc5fab027dee6b6e0734b6e7682111d6e168c00dfe2e18a",

canonicalRequest:
"""
GET
/
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bmy-header1%3Bx-amz-date
host:example.amazonaws.com
my-header1:value1
x-amz-date:20150830T123600Z

host;my-header1;x-amz-date
UNSIGNED-PAYLOAD
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
1cae8ed14c91694d9a42ca9deac2d3430e8ec09287b44c79a5745acb986f6e36
""",

signature:
"""
85e97ffeac044f345cc5fab027dee6b6e0734b6e7682111d6e168c00dfe2e18a
"""
),

// MARK: - Test Case "get-s3-specialchars"

SigV4TestCase(

testCaseName: "get-s3-specialchars",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

shouldSignBody: true,
shouldSignSecurityToken: true,
serviceName: "s3",

// When
originalRequest:
"""
GET /a%3Ab/%26%24%40%3D%3B%3A%2B%20%2C%3F.zip HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/a%3Ab/%26%24%40%3D%3B%3A%2B%20%2C%3F.zip?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=862c9a61c9079ce9f918b144c746d801e20f476df42cb331fc1ad6c1e206a144",

canonicalRequest:
"""
GET
/a%3Ab/%26%24%40%3D%3B%3A%2B%20%2C%3F.zip
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/s3/aws4_request
62a83f6b07e24288441e1bec24708ee573de60786832bbef3b54029f524e7ebb
""",

signature:
"""
862c9a61c9079ce9f918b144c746d801e20f476df42cb331fc1ad6c1e206a144
"""
),

// MARK: - Test Case "get-specialchars"

SigV4TestCase(

testCaseName: "get-specialchars",

// Given

credentialsProvider: SigV4TestCredentials.basicTestCredentials,

shouldSignBody: true,
shouldSignSecurityToken: true,

// When
originalRequest:
"""
GET /maps/v0/maps/GeoTestMap/glyphs/Noto%20Sans%20Italic/0-255.pbf HTTP/1.1
Host:example.amazonaws.com
X-Amz-Date:20150830T123600Z
""",

// Then
expectedPresignedURL: "https://example.amazonaws.com/maps/v0/maps/GeoTestMap/glyphs/Noto%20Sans%20Italic/0-255.pbf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date&X-Amz-Signature=9da808880f614667ea85b051a3a923e9c2803c67e19a69c17961f7a5a7036644",

canonicalRequest:
"""
GET
/maps/v0/maps/GeoTestMap/glyphs/Noto%2520Sans%2520Italic/0-255.pbf
X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fservice%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host%3Bx-amz-date
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
""",

stringToSign:
"""
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
cc9bc93d26ffe2cf1dbd390436a369cc3ae284d4ab0742f8b022f47091052046
""",

signature:
"""
9da808880f614667ea85b051a3a923e9c2803c67e19a69c17961f7a5a7036644
"""
),


    ]
}
