-
- Downloads
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`.
Showing
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocolTestGenerator.kt 0 additions, 3 deletions...smithy/generators/protocol/ServerProtocolTestGenerator.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpProtocolGenerator.kt 1 addition, 1 deletion...en/server/smithy/protocols/ServerHttpProtocolGenerator.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerRestJson.kt 4 additions, 77 deletions...hy/rust/codegen/server/smithy/protocols/ServerRestJson.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerRestXml.kt 42 additions, 0 deletions...thy/rust/codegen/server/smithy/protocols/ServerRestXml.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerRustXml.kt 0 additions, 106 deletions...thy/rust/codegen/server/smithy/protocols/ServerRustXml.kt
- codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/protocol/MakeOperationGenerator.kt 1 addition, 1 deletion...egen/smithy/generators/protocol/MakeOperationGenerator.kt
- codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/protocols/AwsJson.kt 1 addition, 1 deletion...re/amazon/smithy/rust/codegen/smithy/protocols/AwsJson.kt
- codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/protocols/HttpBindingResolver.kt 1 addition, 1 deletion...ithy/rust/codegen/smithy/protocols/HttpBindingResolver.kt
- codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/protocols/Protocol.kt 2 additions, 2 deletions...e/amazon/smithy/rust/codegen/smithy/protocols/Protocol.kt
- codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/protocols/RestJson.kt 20 additions, 1 deletion...e/amazon/smithy/rust/codegen/smithy/protocols/RestJson.kt
- codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/protocols/serialize/JsonSerializerGenerator.kt 1 addition, 1 deletion...gen/smithy/protocols/serialize/JsonSerializerGenerator.kt
Loading
Please register or sign in to comment