Skip to content
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

Fix logic for deciding when to write a default input body and content-type #1304

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

haydenbaker
Copy link
Contributor

@haydenbaker haydenbaker commented Jun 12, 2024

Description of changes:

  • Fixes a bug where an operation with no input shape is treated with a default payload and therefore has the content-type header added to the request object:
// Serialized request object
HttpRequest {
  method: 'GET',
  ...
  headers: {
    'content-type': 'application/json',   <---- ** Should NOT be set **
    host: 'localhost:3001',
    'x-amz-user-agent': 'aws-sdk-js/0.0.1',
    'user-agent': 'aws-sdk-js/0.0.1 ua/2.0 os/darwin#23.4.0 lang/js md/nodejs#18.20.2',
    'amz-sdk-invocation-id': '32c12c5c-6d20-407b-bfec-b78c6b00a0cd',
    'amz-sdk-request': 'attempt=1; max=3'
  },
  body: '',
  ...
}
  • This leads to a 415, UnsupportedMediaTypeException, when calling a server with said operation

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

@haydenbaker haydenbaker merged commit dddbe3c into main Jun 17, 2024
10 checks passed
@trivikr trivikr deleted the haydebak/fix-default-input-body-logic branch July 1, 2024 14:42
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.

3 participants