Skip to content

Commit

Permalink
add httpChecksumRequired test
Browse files Browse the repository at this point in the history
  • Loading branch information
aajtodd authored and JordonPhillips committed Jul 26, 2021
1 parent 20e4eea commit 6ab6243
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
43 changes: 43 additions & 0 deletions smithy-aws-protocol-tests/model/restJson1/http-checksums.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// This file defines test cases that test HTTP checksum trait(s).
// See: https://awslabs.github.io/smithy/1.0/spec/core/behavior-traits.html#httpchecksumrequired-trait
$version: "1.0"

namespace aws.protocoltests.restjson

use aws.protocols#restJson1
use smithy.test#httpRequestTests

/// This example tests httpChecksumRequired trait
@httpChecksumRequired
@http(uri: "/HttpChecksumRequired", method: "POST")
operation HttpChecksumRequired {
input: HttpChecksumRequiredInputOutput,
output: HttpChecksumRequiredInputOutput
}

structure HttpChecksumRequiredInputOutput{
foo: String
}

apply HttpChecksumRequired @httpRequestTests([
{
id: "RestJsonHttpChecksumRequired",
documentation: "Adds Content-MD5 header",
protocol: restJson1,
method: "POST",
uri: "/HttpChecksumRequired",
body: """
{
"foo":"base64 encoded md5 checksum"
}
""",
bodyMediaType: "application/json",
headers: {
"Content-Type": "application/json",
"Content-MD5": "iB0/3YSo7maijL0IGOgA9g=="
},
params: {
foo: "base64 encoded md5 checksum"
}
}
])
3 changes: 3 additions & 0 deletions smithy-aws-protocol-tests/model/restJson1/main.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,8 @@ service RestJson {

// custom endpoints with paths
HostWithPathOperation,

// checksum(s)
HttpChecksumRequired,
]
}

0 comments on commit 6ab6243

Please sign in to comment.