Hello guys,
I'm trying to make a file upload with Akka Http, but I'm getting an error
about Unsupported Media Type, requiring me to send application/json. But
it's a file upload, so my content-type is multipart/form-data.
Where can I configure Akka Http to support this
content-type(multipart/form-data)?
Here is my code:
(post & path("photos")) {
extractRequest { request =>
request.entity.dataBytes.via(photoUpload).to(Sink.ignore).run()
complete(OK)
}
}
val photoUpload =
Flow[ByteString]
.map(file => {
val bucket = s3.bucket("test")
val metadata: ObjectMetadata = new ObjectMetadata()
metadata.setContentLength(file.toArray.length)
bucket.get.putObject("testImage", file.toArray, metadata)
})
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.