I'm using Play.WS to issue http requests. My goal is to send a put request with a large file.
val requestHolder = WS.url("http://" + host) requestHolder.put(???)
I don't know what should be the type of ??? to stream the body. The requestHolder has a put(File file) method - which I can't use because I don't have the file - and put[T](T body) where T can be anything as long as you have an instance of Writable[T].
There are some default writables defined for json, text, xml, etc. But non for an InputStream for example.
The documentation gives a (brief) hint to handle large responses but nothing about large requests (http://www.playframework.com/documentation/2.2.x/ScalaWS)
Anyone knows how to define a writable that would accept an InputStream? Or maybe an Iteratee?
WS underlying client takes
InputStream. Access it like this:
import com.ning.http.client.AsyncHttpClient val client:AsyncHttpClient = WS.client
Unfortunately, this isn't supported yet.
There is a little discussion about it here:
And we're hoping that for Play 2.3, we will have a solution to allow it.