*/
@Test
public void postHtmlFile() throws IOException {
Document index = Jsoup.connect("http://direct.infohound.net/tidy/").get();
FormElement form = index.select("[name=tidy]").forms().get(0);
Connection post = form.submit();
File uploadFile = ParseTest.getFile("/htmltests/google-ipod.html");
FileInputStream stream = new FileInputStream(uploadFile);
// todo: need to add a better way to get an existing data field
for (Connection.KeyVal keyVal : post.request().data()) {
if (keyVal.key().equals("_file")) {
keyVal.value("check.html");
keyVal.inputStream(stream);
}
}
Connection.Response res;
try {
res = post.execute();
} finally {
stream.close();
}
Document out = res.parse();