Loading codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocolTestGenerator.kt +0 −2 Original line number Diff line number Diff line Loading @@ -772,8 +772,6 @@ class ServerProtocolTestGenerator( FailingTest(RestJson, "RestJsonEndpointTrait", TestType.Request), FailingTest(RestJson, "RestJsonEndpointTraitWithHostLabel", TestType.Request), FailingTest(RestJson, "RestJsonWithBodyExpectsApplicationJsonContentType", TestType.MalformedRequest), // Tests involving `@range` on floats. // Pending resolution from the Smithy team, see https://github.com/awslabs/smithy-rs/issues/2007. FailingTest(RestJsonValidation, "RestJsonMalformedRangeFloat_case0", TestType.MalformedRequest), Loading codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt +15 −1 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import software.amazon.smithy.rust.codegen.core.smithy.mapRustType import software.amazon.smithy.rust.codegen.core.smithy.protocols.HttpBindingDescriptor import software.amazon.smithy.rust.codegen.core.smithy.protocols.HttpBoundProtocolPayloadGenerator import software.amazon.smithy.rust.codegen.core.smithy.protocols.HttpLocation import software.amazon.smithy.rust.codegen.core.smithy.protocols.RestJson import software.amazon.smithy.rust.codegen.core.smithy.protocols.parse.StructuredDataParserGenerator import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticInputTrait import software.amazon.smithy.rust.codegen.core.smithy.transformers.operationErrors Loading Loading @@ -628,6 +629,19 @@ private class ServerHttpBoundProtocolTraitImplGenerator( """ let bytes = #{Hyper}::body::to_bytes(body).await?; if !bytes.is_empty() { """, *codegenScope, ) if (protocol is RestJson) { rustTemplate( """ #{SmithyHttpServer}::protocols::content_type_header_classifier(&parts.headers, Some("application/json"))?; """, *codegenScope, ) } rustTemplate( """ input = #{parser}(bytes.as_ref(), input)?; } """, Loading Loading
codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocolTestGenerator.kt +0 −2 Original line number Diff line number Diff line Loading @@ -772,8 +772,6 @@ class ServerProtocolTestGenerator( FailingTest(RestJson, "RestJsonEndpointTrait", TestType.Request), FailingTest(RestJson, "RestJsonEndpointTraitWithHostLabel", TestType.Request), FailingTest(RestJson, "RestJsonWithBodyExpectsApplicationJsonContentType", TestType.MalformedRequest), // Tests involving `@range` on floats. // Pending resolution from the Smithy team, see https://github.com/awslabs/smithy-rs/issues/2007. FailingTest(RestJsonValidation, "RestJsonMalformedRangeFloat_case0", TestType.MalformedRequest), Loading
codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt +15 −1 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import software.amazon.smithy.rust.codegen.core.smithy.mapRustType import software.amazon.smithy.rust.codegen.core.smithy.protocols.HttpBindingDescriptor import software.amazon.smithy.rust.codegen.core.smithy.protocols.HttpBoundProtocolPayloadGenerator import software.amazon.smithy.rust.codegen.core.smithy.protocols.HttpLocation import software.amazon.smithy.rust.codegen.core.smithy.protocols.RestJson import software.amazon.smithy.rust.codegen.core.smithy.protocols.parse.StructuredDataParserGenerator import software.amazon.smithy.rust.codegen.core.smithy.traits.SyntheticInputTrait import software.amazon.smithy.rust.codegen.core.smithy.transformers.operationErrors Loading Loading @@ -628,6 +629,19 @@ private class ServerHttpBoundProtocolTraitImplGenerator( """ let bytes = #{Hyper}::body::to_bytes(body).await?; if !bytes.is_empty() { """, *codegenScope, ) if (protocol is RestJson) { rustTemplate( """ #{SmithyHttpServer}::protocols::content_type_header_classifier(&parts.headers, Some("application/json"))?; """, *codegenScope, ) } rustTemplate( """ input = #{parser}(bytes.as_ref(), input)?; } """, Loading