Skip to content

Commit 86e38e0

Browse files
authored
Add restJson1 protocol test for content-type and operation with no input (#2322)
1 parent e2e7684 commit 86e38e0

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

smithy-aws-protocol-tests/model/restJson1/http-content-type.smithy

+28
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,31 @@ structure TestNoPayloadInputOutput {
284284
@httpHeader("X-Amz-Test-Id")
285285
testId: String,
286286
}
287+
288+
/// This example operation has no input and serializes a request without an HTTP body.
289+
///
290+
/// These tests are to ensure we do not attach a body or related headers
291+
/// (Content-Length, Content-Type) to operations that semantically
292+
/// cannot produce an HTTP body.
293+
///
294+
@readonly
295+
@http(uri: "/no_input_no_payload", method: "GET")
296+
operation TestNoInputNoPayload {
297+
output: TestNoPayloadInputOutput
298+
}
299+
300+
apply TestNoInputNoPayload @httpRequestTests([
301+
{
302+
id: "RestJsonHttpWithNoInput",
303+
documentation: "Serializes a GET request for an operation with no input, and therefore no modeled body",
304+
protocol: restJson1,
305+
method: "GET",
306+
uri: "/no_input_no_payload",
307+
body: "",
308+
forbidHeaders: [
309+
"Content-Length",
310+
"Content-Type"
311+
],
312+
params: {}
313+
}
314+
])

smithy-aws-protocol-tests/model/restJson1/main.smithy

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ service RestJson {
146146
TestPayloadStructure,
147147
TestPayloadBlob,
148148
TestNoPayload,
149+
TestNoInputNoPayload,
149150

150151
// client-only timestamp parsing tests
151152
DatetimeOffsets,

0 commit comments

Comments
 (0)