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

@restJson1 and charset=utf8 in the header #3471

Closed
x1a0 opened this issue Mar 7, 2024 · 2 comments · Fixed by #3724
Closed

@restJson1 and charset=utf8 in the header #3471

x1a0 opened this issue Mar 7, 2024 · 2 comments · Fixed by #3724
Labels
bug Something isn't working server Rust server SDK

Comments

@x1a0
Copy link

x1a0 commented Mar 7, 2024

Hi,

Probably a stupid question - I have a service defined with @restJson1. The incoming requests that have header Content-Type: application/json work fine.
However if they carry header Content-Type: application/json; charset=utf8, the server just returns:

415 Unsupported Media Type

Is there anyway to configure the header value matching somehow?
Thanks in advance.

@x1a0
Copy link
Author

x1a0 commented Mar 8, 2024

Looks like charset should not be set for application/json. I will add a layer to remove it.

@x1a0 x1a0 closed this as completed Mar 8, 2024
@david-perez
Copy link
Contributor

Actually, servers should accept this kind of requests. We recently identified this bug and it is being fixed in #3576.

@david-perez david-perez added bug Something isn't working server Rust server SDK labels Apr 11, 2024
djedward added a commit to djedward/smithy-rs that referenced this issue Apr 11, 2024
djedward added a commit to djedward/smithy-rs that referenced this issue Jun 27, 2024
djedward added a commit to djedward/smithy-rs that referenced this issue Jun 27, 2024
github-merge-queue bot pushed a commit that referenced this issue Jun 28, 2024
Fixes: #3471

## Motivation and Context
An issue was raised about a mobile client that appends "; charset=utf-8"
to the Content-Type when using restJson1. The [latest
RFC](https://www.rfc-editor.org/rfc/rfc8259) for "application/json" does
not register a charset parameter, but indicates it is reasonable to
accept it.

## Description
This change loosens the validation of the expected content type to allow
all parameters.

## Testing
* Tests for each protocol were added to
[smithy](smithy-lang/smithy#2296)
* ran the runtime and codegen tests
* Added test for rest-xml, as smithy-rs does not currently run the
smithy tests.

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working server Rust server SDK
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants