Open akka-ci opened 7 years ago
Comment by ktoso
Friday Dec 04, 2015 at 23:58 GMT
More specifically, it's about taking in a request like curl -X POST -d@dat_data.txt
(i.e. not FormData, just raw data in the request body (as seen in dataBytes
).
Comment by 2beaucoup
Monday Dec 07, 2015 at 09:26 GMT
Having thought abou this once again I'm not sure anymore if we should provide such directives (even the existing fileUpload
/uploadedFile
) by default.
"File uploading" could happen in many different ways: Uploading via multipart or plain (POST, PUT) requests, storing as a temp file, direct storage or streaming to consumers. I'm sure there are more.
Trying to provide a directive for every combination doesn't scale. I think we could give better support for extracting things from multipart/formdata entities and provide some samples re. file storage as cookbook recipes. We should rather get the building blocks right than trying to provide a directive for every use case.
@hhimanshu What kind of problems did you come across when implementing your uploads? Was it just getting the curl stuff right or with implementing the service itself?
/cc @sirthias
Comment by johanandren
Monday Dec 07, 2015 at 09:57 GMT
There just was a discussion like this in #19108
It's a hard balance between the API being easy to pick up and bloated with special use cases.
Comment by johanandren
Monday Dec 07, 2015 at 09:59 GMT
I think we could just provide some documentation about POSTing files here: http://doc.akka.io/docs/akka-stream-and-http-experimental/2.0-M2/scala/http/routing-dsl/index.html#File_uploads
Comment by johanandren
Thursday May 19, 2016 at 06:41 GMT
Well, not really, no docs added and no directive for it. (http://doc.akka.io/docs/akka/2.4.5/scala/http/routing-dsl/index.html#File_uploads)
As discussed in https://github.com/akka/akka/issues/19092, it would be nice to have a directive that can be used to upload files.
Opened ticket as discussed with @ktoso