smithy
smithy copied to clipboard
Add protocol test for httpPayload trait applied to a string member
The existing tests for httppyaload-trait
: https://github.com/awslabs/smithy/blob/main/smithy-aws-protocol-tests/model/restJson1/http-payload.smithy
Existing tests do not cover the Serialization rule:
When a string ... member is referenced, the raw value is serialized as the body of the message.
Can you add a test to cover httpPayload trait applied to a string member?
Something like:
structure HttpPayloadTraitsStringInputOutput {
@httpPayload
bodyMember: String,
}
@http(uri: "/HttpPayloadTraitsString", method: "POST")
operation HttpPayloadTraitsString {
input: HttpPayloadTraitsStringInputOutput ,
output: HttpPayloadTraitsStringInputOutput
}
apply HttpPayloadTraitsString @httpRequestTests([
{
id: "RestJsonHttpPayloadTraitsWithString",
documentation: "Serializes a string in the HTTP payload",
protocol: restJson1,
method: "POST",
uri: "/HttpPayloadTraitsString",
body: "Hello World",
params: {
bodyMember: "Hello World"
}
}
])