Skip to content

Commit 2204882

Browse files
authored
fix: use correct content type (#400)
1 parent f6cd7ba commit 2204882

File tree

9 files changed

+15
-22
lines changed

9 files changed

+15
-22
lines changed

codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSHttpBindingProtocolGenerator.kt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,14 @@ abstract class AWSHttpBindingProtocolGenerator : HttpBindingProtocolGenerator()
4444
override val shouldRenderCodingKeysForEncodable = true
4545

4646
override fun generateProtocolUnitTests(ctx: ProtocolGenerator.GenerationContext): Int {
47-
val testsToIgnore = setOf(
48-
"RestJsonHttpPayloadTraitsWithBlob",
49-
"RestJsonHttpPayloadTraitsWithMediaTypeWithBlob",
50-
"RestJsonStreamingTraitsWithBlob",
51-
"RestJsonStreamingTraitsRequireLengthWithBlob",
52-
"RestJsonStreamingTraitsWithMediaTypeWithBlob"
53-
)
5447
return HttpProtocolTestGenerator(
5548
ctx,
5649
requestTestBuilder,
5750
responseTestBuilder,
5851
errorTestBuilder,
5952
httpProtocolCustomizable,
6053
operationMiddleware,
61-
serdeContext,
62-
testsToIgnore
54+
serdeContext
6355
).generateProtocolTests()
6456
}
6557

codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/FormURLHttpBindingResolver.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import software.amazon.smithy.swift.codegen.integration.protocols.core.StaticHtt
1212

1313
class FormURLHttpBindingResolver(
1414
private val context: ProtocolGenerator.GenerationContext,
15-
) : StaticHttpBindingResolver(context, httpTrait) {
15+
private val contentType: String
16+
) : StaticHttpBindingResolver(context, httpTrait, contentType) {
1617

1718
companion object {
1819
private val httpTrait: HttpTrait = HttpTrait

codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGenerator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class PresignerGenerator : SwiftIntegration {
5959
writer.addImport(SdkHttpRequest)
6060

6161
val operationsIndex = OperationIndex.of(ctx.model)
62-
val httpBindingResolver = protocolGenerator.getProtocolHttpBindingResolver(protocolGeneratorContext)
62+
val httpBindingResolver = protocolGenerator.getProtocolHttpBindingResolver(protocolGeneratorContext, protocolGenerator.defaultContentType)
6363

6464
writer.openBlock("extension $inputType {", "}") {
6565
writer.openBlock("public func presign(config: \$N) -> \$T {", "}", AWSClientConfiguration, SdkHttpRequest) {

codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AwsJson1_0_ProtocolGenerator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ open class AwsJson1_0_ProtocolGenerator : AWSHttpBindingProtocolGenerator() {
3030
AWSJsonHttpResponseBindingErrorGenerator()
3131
)
3232
override val serdeContext = serdeContextJSON
33-
override fun getProtocolHttpBindingResolver(ctx: ProtocolGenerator.GenerationContext):
34-
HttpBindingResolver = AwsJsonHttpBindingResolver(ctx)
33+
override fun getProtocolHttpBindingResolver(ctx: ProtocolGenerator.GenerationContext, defaultContentType: String):
34+
HttpBindingResolver = AwsJsonHttpBindingResolver(ctx, defaultContentType)
3535

3636
override fun addProtocolSpecificMiddleware(ctx: ProtocolGenerator.GenerationContext, operation: OperationShape) {
3737
super.addProtocolSpecificMiddleware(ctx, operation)

codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AwsJson1_1_ProtocolGenerator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class AwsJson1_1_ProtocolGenerator : AWSHttpBindingProtocolGenerator() {
3030
AWSJsonHttpResponseBindingErrorGenerator()
3131
)
3232
override val serdeContext = serdeContextJSON
33-
override fun getProtocolHttpBindingResolver(ctx: ProtocolGenerator.GenerationContext):
34-
HttpBindingResolver = AwsJsonHttpBindingResolver(ctx)
33+
override fun getProtocolHttpBindingResolver(ctx: ProtocolGenerator.GenerationContext, defaultContentType: String):
34+
HttpBindingResolver = AwsJsonHttpBindingResolver(ctx, defaultContentType)
3535

3636
override fun addProtocolSpecificMiddleware(ctx: ProtocolGenerator.GenerationContext, operation: OperationShape) {
3737
super.addProtocolSpecificMiddleware(ctx, operation)

codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AwsJsonHttpBindingResolver.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import software.amazon.smithy.swift.codegen.integration.protocols.core.StaticHtt
1212

1313
class AwsJsonHttpBindingResolver(
1414
private val context: ProtocolGenerator.GenerationContext,
15-
) : StaticHttpBindingResolver(context, awsJsonHttpTrait) {
15+
private val defaultContentType: String
16+
) : StaticHttpBindingResolver(context, awsJsonHttpTrait, defaultContentType) {
1617

1718
companion object {
1819
private val awsJsonHttpTrait: HttpTrait = HttpTrait

codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/AwsQueryProtocolGenerator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ open class AwsQueryProtocolGenerator : AWSHttpBindingProtocolGenerator() {
5151
)
5252

5353
override val serdeContext = HttpProtocolUnitTestGenerator.SerdeContext("FormURLEncoder()", "XMLDecoder()")
54-
override fun getProtocolHttpBindingResolver(ctx: ProtocolGenerator.GenerationContext):
55-
HttpBindingResolver = FormURLHttpBindingResolver(ctx)
54+
override fun getProtocolHttpBindingResolver(ctx: ProtocolGenerator.GenerationContext, defaultContentType: String):
55+
HttpBindingResolver = FormURLHttpBindingResolver(ctx, defaultContentType)
5656

5757
override val shouldRenderDecodableBodyStructForInputShapes = false
5858
override val shouldRenderCodingKeysForEncodable = false

codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/ec2query/Ec2QueryProtocolGenerator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class Ec2QueryProtocolGenerator : AWSHttpBindingProtocolGenerator() {
4444
)
4545

4646
override val serdeContext = HttpProtocolUnitTestGenerator.SerdeContext("FormURLEncoder()", "XMLDecoder()")
47-
override fun getProtocolHttpBindingResolver(ctx: ProtocolGenerator.GenerationContext):
48-
HttpBindingResolver = FormURLHttpBindingResolver(ctx)
47+
override fun getProtocolHttpBindingResolver(ctx: ProtocolGenerator.GenerationContext, contentType: String):
48+
HttpBindingResolver = FormURLHttpBindingResolver(ctx, contentType)
4949

5050
override val shouldRenderDecodableBodyStructForInputShapes = false
5151
override val shouldRenderCodingKeysForEncodable = false

codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/RestXmlProtocolGenerator.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ class RestXmlProtocolGenerator : AWSHttpBindingProtocolGenerator() {
7171
"S3VirtualHostDualstackAddressing",
7272
"S3VirtualHostAccelerateAddressing",
7373
"S3VirtualHostDualstackAccelerateAddressing",
74-
"S3OperationAddressingPreferred",
75-
"HttpPayloadTraitsWithMediaTypeWithBlob" // content type
74+
"S3OperationAddressingPreferred"
7675
)
7776
return HttpProtocolTestGenerator(
7877
ctx,

0 commit comments

Comments
 (0)