Skip to content

fix: reject content-type header when there is no modeled input #1563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

smilkuri
Copy link
Contributor

@smilkuri smilkuri commented Apr 14, 2025

Reject the content-type header when there is no modeled input and the body must be empty for the protocol test.

v3: aws/aws-sdk-js-v3#7016 after making the change to check for input shape validation and has at least 1 member


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@smilkuri smilkuri requested a review from a team as a code owner April 14, 2025 18:43
@smilkuri smilkuri marked this pull request as draft April 16, 2025 02:52
writer.write("const contentTypeHeaderKey: string | undefined = Object.keys(output.headers)"
+ ".find(key => key.toLowerCase() === 'content-type');");
writer.openBlock("if (contentTypeHeaderKey != null) {", "};", () -> {
writer.write("const contentType = output.headers[contentTypeHeaderKey];");
if (optionalContentType.isPresent() || operation.getInput().isPresent()) {
if (optionalContentType.isPresent() || hasInputWithMembers) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasInputWithMembers should probably be replaced with

HttpBindingIndex.of(context.getModel()).hasRequestBody(operation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants