Add protocol tests for Content-Type and Content-Length for empty body
https://github.com/awslabs/smithy-typescript/issues/552 is reported in smithy-typescript with proposed fix https://github.com/awslabs/smithy-typescript/pull/553. We are missing protocol tests that specify these behaviors.
I've added a bunch of test cases. I've just written them quickly without building the package, so there may be typos, bad naming, bad documentation, mistakes in these. And some might be repetitive. But I wanted to get started on these, so pushing this PR out so someone can pick it up. I think having these would require the fix from https://github.com/awslabs/smithy-typescript/pull/553 and maybe more, and maybe across other smithy generators too.
For reference, earlier PR that added the forbidHeader cases in http-content-type, for GET only. The Content-Length assertions in these tests are based on https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2
A user agent SHOULD send a Content-Length in a request message when no Transfer-Encoding is sent and the request method defines a meaning for an enclosed payload body. For example, a Content-Length header field is normally sent in a POST request even when the value is 0 (indicating an empty payload body). A user agent SHOULD NOT send a Content-Length header field when the request message does not contain a payload body and the method semantics do not anticipate such a body.
** This could change existing behavior of some SDKs. Double check if this is all good.
I also found this related open PR in our repo - https://github.com/awslabs/smithy/pull/1399.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.