Upload Zip File
ibsoft opened this issue · 5 comments
ibsoft commented
Hi there! How do I upload a Zip file? like --data-binary (Curl Option)
Thanks in advance
libetl commented
Hi, very good idea indeed.
What do we expect as argument ? a file, an url ? what is the syntax ?
ibsoft commented
A file would be good.
ex. curl -X PUT -u user:password "https://site.cloud.com/remote.php/webdav/backup.zip" --data-binary "@/home/user/backup.zip"
libetl commented
Great, thanks.
I will see what I can do with @ parameters.
Same applies for -d @ myFile
libetl commented
will be released in 0.0.14 in a few hours.
Try again then, and reopen the issue if it does not work fine.
Good luck.
libetl commented
FYI new unit test added :
@Test
public void withBinaryData () throws IOException {
HttpResponse response = this.curl ("-k -E src/test/resources/clients/libe/libe.pem --data-binary \"@src/test/resources/clients/libe/libe.der\" -X POST -H 'Accept: */*' -H 'Host: localhost' 'https://localhost:%d/public/data'");
String expected = IOUtils.toString(Thread.currentThread().getContextClassLoader().getResourceAsStream("clients/libe/libe.der"));
String fullCurl = IOUtils.toString(response.getEntity().getContent());
String actual = fullCurl.substring(fullCurl.indexOf("-d '") + 4, fullCurl.indexOf("' 'https"));
Assertions.assertThat (actual).isEqualTo (expected);
}