I am using play 2.5.x ws library for a file upload to an internal server. I have sample code working with apache http/curl/postman. But when I try to use ws library some how its failing. I don't have access to the internal server and its not returning any error message
I have checked the request headers from both requests(apache http/play WS) and I see that "Content length " header is missing from WS request. I tried to set it with
ws.url(url).setHeader().post(Source.from(Arrays.asList(fp,name)
but I am getting
"Stream has already been consumed and cannot be reset"
Is there any way I can set the content length ?. Or is there anything else I am missing.
Unfortunately, this is not properly documented, but you can look at the code to understand how
post(Source)works:-1is the default.So, currently, it us up to you to set
Content-Lengthor make your server accept chunked transfer.