Always set `Content-Type` header in RestJson1 responses (#1131)
The protocol specifies it should be set by default to `application/json` in HTTP responses, even when there are no output shape members, since in that case an empty JSON payload `{}` is serialized. There are server protocol tests asserting this behavior. To implement this behavior, the `RestJsonHttpBindingResolver` class has been introduced, which mostly delegates to the `HttpTraitHttpBindingResolver`, but tweaks the response `Content-Type` header. Note this behavior is different than the client's, which should not serialize a JSON payload if there are no input shape members to be serialized to the body, and as such does not need to set the `Content-Type` header. This commit also deletes the `ServerRestJson` and `ServerRestXml` classes, since they were exact copies of their client counterparts. The latter was hosted in `ServerRustXml.kt`, which has been renamed to `ServerRestXml.kt`.
Loading
Please register or sign in to comment