Skip to content

Commit

Permalink
Add restJson1 protocol test for content-type and operation with no in…
Browse files Browse the repository at this point in the history
…put (#2322)
  • Loading branch information
haydenbaker committed Jun 17, 2024
1 parent e2e7684 commit 86e38e0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
28 changes: 28 additions & 0 deletions smithy-aws-protocol-tests/model/restJson1/http-content-type.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,31 @@ structure TestNoPayloadInputOutput {
@httpHeader("X-Amz-Test-Id")
testId: String,
}

/// This example operation has no input and serializes a request without an HTTP body.
///
/// These tests are to ensure we do not attach a body or related headers
/// (Content-Length, Content-Type) to operations that semantically
/// cannot produce an HTTP body.
///
@readonly
@http(uri: "/no_input_no_payload", method: "GET")
operation TestNoInputNoPayload {
output: TestNoPayloadInputOutput
}

apply TestNoInputNoPayload @httpRequestTests([
{
id: "RestJsonHttpWithNoInput",
documentation: "Serializes a GET request for an operation with no input, and therefore no modeled body",
protocol: restJson1,
method: "GET",
uri: "/no_input_no_payload",
body: "",
forbidHeaders: [
"Content-Length",
"Content-Type"
],
params: {}
}
])
1 change: 1 addition & 0 deletions smithy-aws-protocol-tests/model/restJson1/main.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ service RestJson {
TestPayloadStructure,
TestPayloadBlob,
TestNoPayload,
TestNoInputNoPayload,

// client-only timestamp parsing tests
DatetimeOffsets,
Expand Down

0 comments on commit 86e38e0

Please sign in to comment.