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

Add protocol test for when content-type must be set but no headers are sent #2310

Conversation

david-perez
Copy link
Contributor

The suite already contains a test with ID
RestJsonWithBodyExpectsApplicationJsonContentType for when Content-Type: aplication/json is expected by the server but the client sends a wrong value
for the header. However, there is no test testing the case where the client
sends no headers. This commit adds such a test.

Testing

  • Ran the test in smithy-rs server.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…e sent

The suite already contains a test with ID
`RestJsonWithBodyExpectsApplicationJsonContentType` for when
`Content-Type: aplication/json` is expected by the server but the client
sends a wrong value for the header. However, there is no test testing
the case where the client sends no headers. This commit adds such a
test.
@david-perez david-perez requested a review from a team as a code owner June 6, 2024 13:23
…lformed-content-type.smithy

Co-authored-by: Kevin Stich <kevin@kstich.com>
@kstich kstich merged commit 25f4023 into smithy-lang:main Jun 6, 2024
13 checks passed
@david-perez david-perez deleted the davidpz/rest-json-with-body-expects-application-json-content-type-no-headers branch June 7, 2024 08:43
david-perez added a commit to david-perez/smithy that referenced this pull request Jun 7, 2024
Initial motivation for this stems off smithy-lang#2310, but for when the input is
`@httpPayload`-bound. It's important that we test `Content-Type`
specifically with `@httpPayload` operations, because the header can be
checked without having to inspect the body, and because the spec has
special provisions
(https://smithy.io/2.0/aws/protocols/aws-restjson1-protocol.html#content-type).

There were no protocol tests exercising `Content-Type` when the input is
`@httpPayload`-bound:

- In the case of blobs, servers must accept any (test already exists)
  and no `Content-Type` (test added in this commit).
- In other cases, there were protocol tests for `union` and `structure`
  shapes. I've added an operation with an `@httpPayload`-bound string
  shape. Note that `document` shapes remain untested.
JordonPhillips pushed a commit that referenced this pull request Jun 17, 2024
Initial motivation for this stems off #2310, but for when the input is
`@httpPayload`-bound. It's important that we test `Content-Type`
specifically with `@httpPayload` operations, because the header can be
checked without having to inspect the body, and because the spec has
special provisions
(https://smithy.io/2.0/aws/protocols/aws-restjson1-protocol.html#content-type).

There were no protocol tests exercising `Content-Type` when the input is
`@httpPayload`-bound:

- In the case of blobs, servers must accept any (test already exists)
  and no `Content-Type` (test added in this commit).
- In other cases, there were protocol tests for `union` and `structure`
  shapes. I've added an operation with an `@httpPayload`-bound string
  shape. Note that `document` shapes remain untested.
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