This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch CAMEL-17358 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 15455f33507b6c409fa23c3d37aa32317e68fa65 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Thu Jan 13 11:26:33 2022 +0100 CAMEL-17358 - AWS SDK2 Producer does not set the Content Type at all --- .../s3/integration/S3SimpleUploadOperationIT.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3SimpleUploadOperationIT.java b/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3SimpleUploadOperationIT.java index 3387868..536de40 100644 --- a/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3SimpleUploadOperationIT.java +++ b/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3SimpleUploadOperationIT.java @@ -26,7 +26,12 @@ import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.aws2.s3.AWS2S3Constants; import org.apache.camel.component.aws2.s3.AWS2S3Operations; import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils; import org.junit.jupiter.api.Test; +import software.amazon.awssdk.core.ResponseInputStream; +import software.amazon.awssdk.services.s3.S3Client; +import software.amazon.awssdk.services.s3.model.GetObjectRequest; +import software.amazon.awssdk.services.s3.model.GetObjectResponse; import software.amazon.awssdk.services.s3.model.S3Object; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -68,6 +73,25 @@ public class S3SimpleUploadOperationIT extends Aws2S3Base { assertMockEndpointsSatisfied(); } + @Test + public void sendInWithContentType() throws Exception { + result.expectedMessageCount(1); + + template.send("direct:putObject", new Processor() { + + @Override + public void process(Exchange exchange) throws Exception { + exchange.getIn().setHeader(AWS2S3Constants.KEY, "camel-content-type.txt"); + exchange.getIn().setHeader(AWS2S3Constants.CONTENT_TYPE, "application/text"); + exchange.getIn().setBody("Camel rocks!"); + } + }); + + S3Client s = AWSSDKClientUtils.newS3Client(); + ResponseInputStream<GetObjectResponse> response = s.getObject(GetObjectRequest.builder().bucket("mycamel").key("camel-content-type.txt").build()); + assertEquals("application/text", response.response().contentType()); + } + @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() {