Skip to content

Commit

Permalink
Add XML string payload protocol test (#2007)
Browse files Browse the repository at this point in the history
* Add XML string payload protocol test
  • Loading branch information
davidh44 authored Oct 12, 2023
1 parent 557d285 commit 1251dc2
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use smithy.test#httpResponseTests
@http(uri: "/EnumPayload", method: "POST")
@httpRequestTests([
{
id: "EnumPayloadRequest",
id: "RestJsonEnumPayloadRequest",
uri: "/EnumPayload",
body: "enumvalue",
params: { payload: "enumvalue" },
Expand All @@ -18,7 +18,7 @@ use smithy.test#httpResponseTests
])
@httpResponseTests([
{
id: "EnumPayloadResponse",
id: "RestJsonEnumPayloadResponse",
body: "enumvalue",
params: { payload: "enumvalue" },
protocol: "aws.protocols#restJson1",
Expand All @@ -42,7 +42,7 @@ enum StringEnum {
@http(uri: "/StringPayload", method: "POST")
@httpRequestTests([
{
id: "StringPayloadRequest",
id: "RestJsonStringPayloadRequest",
uri: "/StringPayload",
body: "rawstring",
params: { payload: "rawstring" },
Expand All @@ -52,7 +52,7 @@ enum StringEnum {
])
@httpResponseTests([
{
id: "StringPayloadResponse",
id: "RestJsonStringPayloadResponse",
body: "rawstring",
params: { payload: "rawstring" },
protocol: "aws.protocols#restJson1",
Expand Down
70 changes: 70 additions & 0 deletions smithy-aws-protocol-tests/model/restXml/http-string-payload.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
$version: "2.0"

namespace aws.protocoltests.restxml

use smithy.test#httpRequestTests
use smithy.test#httpResponseTests

@http(uri: "/EnumPayload", method: "POST")
@httpRequestTests([
{
id: "RestXmlEnumPayloadRequest",
uri: "/EnumPayload",
body: "enumvalue",
params: { payload: "enumvalue" },
method: "POST",
protocol: "aws.protocols#restXml"
}
])
@httpResponseTests([
{
id: "RestXmlEnumPayloadResponse",
body: "enumvalue",
params: { payload: "enumvalue" },
protocol: "aws.protocols#restXml",
code: 200
}
])
operation HttpEnumPayload {
input: EnumPayloadInput,
output: EnumPayloadInput
}

structure EnumPayloadInput {
@httpPayload
payload: StringEnum
}

enum StringEnum {
V = "enumvalue"
}

@http(uri: "/StringPayload", method: "POST")
@httpRequestTests([
{
id: "RestXmlStringPayloadRequest",
uri: "/StringPayload",
body: "rawstring",
params: { payload: "rawstring" },
method: "POST",
protocol: "aws.protocols#restXml"
}
])
@httpResponseTests([
{
id: "RestXmlStringPayloadResponse",
body: "rawstring",
params: { payload: "rawstring" },
protocol: "aws.protocols#restXml",
code: 200
}
])
operation HttpStringPayload {
input: StringPayloadInput,
output: StringPayloadInput
}

structure StringPayloadInput {
@httpPayload
payload: String
}
2 changes: 2 additions & 0 deletions smithy-aws-protocol-tests/model/restXml/main.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ service RestXml {
HttpPayloadTraits,
HttpPayloadTraitsWithMediaType,
HttpPayloadWithStructure,
HttpEnumPayload,
HttpStringPayload,
HttpPayloadWithUnion,
HttpPayloadWithXmlName,
BodyWithXmlName,
Expand Down

0 comments on commit 1251dc2

Please sign in to comment.