Closed dzikoysk closed 2 years ago
This IS actually supported (sort of) as a named param file https://github.com/Kong/unirest-java/blob/main/unirest/src/test/java/BehaviorTests/MultiPartFormPostingTest.java#L64
It's true there is not a method as a raw body octet stream (not a named file)
Yeah, but parametrized files are a part of forms to upload multiple files, it's slightly different case than just a huge body of the request itself I guess 🤔 Tbh it's not only related to files, but it was easier for me to show it on an example I'm currently working on. Such an API is in general useful to handle InputStream requests that may come from various different sources.
this is released in 3.13.0. Try it out and let me know what you think. You can also add a progress monitor to it (though it doesn't know the total size of the stream of course, so you just get the bits written and the total of bytes written on each chunk.
Is your feature request related to a problem? Please describe.
I'd like to send large files, especially in tests, to check if server is able to large handle incoming data, e.g. with:
Describe the solution you'd like
Just a simple
HttpRequestWithBody#body(InputStream)
would be great. It was even referenced in the past as a possible feature, but looks like no one finally did this:It shouldn't be that hard, as InputStream is already implemented in internals as one of available BodyPart, just not exposed as an public API.
Describe alternatives you've considered
Just using another http client for such a case, as literally every client I know support such an option, e.g. Apache's HttpClient: