smithy icon indicating copy to clipboard operation
smithy copied to clipboard

Add protocol test for httpPayload trait applied to a string member

Open ppittle opened this issue 3 years ago • 0 comments

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"
        }
    }
])

ppittle avatar Dec 15 '21 22:12 ppittle