spray icon indicating copy to clipboard operation
spray copied to clipboard

File Backed Upload Capability

Open kutchar opened this issue 9 years ago • 1 comments

Looking at the code, Spray supports file based HttpData for responses (https://github.com/spray/spray/blob/master/spray-http/src/main/scala/spray/http/HttpData.scala#L249), but not requests. I think it'd be great to have the ability to set a threshold of what the largest byte array backed uploaded HttpData could be. Above that threshold, the HttpData will become Compound (https://github.com/spray/spray/blob/master/spray-http/src/main/scala/spray/http/HttpData.scala#L282) with the overflowing portion persisted to disk.

This should allow users to use spray routing to upload large files without dropping down to spray-can level.

kutchar avatar Jul 21 '15 05:07 kutchar

@kutchar it's not completely clear to me what you want to achieve. Is this about multipart/formdata uploads or just regular HTTP request entities (like posting application/json data)?

I haven't looked in there for a while but I do not see a reason why putting file-based HttpData into entities would not work for requests as well (at least for regular entities, multipart/formdata may be harder).

What did you try so far?

In any case, spray will probably not receive any new functionality any more, especially not wrt streaming uploads/downloads or multipart/formdata support. akka-http has first-class support for all of that so it should be the tool of choice if streaming data is a main application.

jrudolph avatar Aug 30 '15 09:08 jrudolph