Hi. I’m using the aws-api to upload a file to S3, and I want to set the Content-Type. I converted a java example I found to roughly this code:
(let [md {"content-type" "text/plain"}
response (core/throw-on-error
(aws/invoke client
{:op :PutObject
:request {:Bucket "<http://company.co|company.co>"
:Key "marc/foo2.txt"
:Body (-> "some text" (.getBytes "UTF-8") (ByteArrayInputStream.))
:Metadata md}}))]
(:Body response))
But this is not working. When I check out the newly uploaded file in Amazon, I see:
• System defined, Content-Type , application/octet-stream
• User defined, x-amz-meta-content-type, text/plain
So, instead of setting the system defined “Content-Type”, it stuffed my value into x-amz-meta-content-type
.
Any suggestions?(aws/doc client :PutObject)
call that @mlimotte and check out the :ContentType option
content type might be special in that it won't appear in Metadata
@ghadi Yep--- that resolved the issue. Was not aware of that divergence from the java sdk. Thanks.
aws-api is generated from descriptor files, which is similar to how the java v2 sdk is generated (but java v1 sdk is ad hoc)