use of org.asynchttpclient.request.body.multipart.FilePart in project async-http-client by AsyncHttpClient.
the class FastUnauthorizedUploadTest method testUnauthorizedWhileUploading.
@Test(groups = "standalone")
public void testUnauthorizedWhileUploading() throws Exception {
File file = createTempFile(1024 * 1024);
try (AsyncHttpClient client = asyncHttpClient()) {
Response response = client.preparePut(getTargetUrl()).addBodyPart(new FilePart("test", file, "application/octet-stream", UTF_8)).execute().get();
assertEquals(response.getStatusCode(), 401);
}
}
use of org.asynchttpclient.request.body.multipart.FilePart in project async-http-client by AsyncHttpClient.
the class FilePartLargeFileTest method testPutLargeTextFile.
@Test(groups = "standalone")
public void testPutLargeTextFile() throws Exception {
File file = createTempFile(1024 * 1024);
try (AsyncHttpClient client = asyncHttpClient(config().setRequestTimeout(100 * 6000))) {
Response response = client.preparePut(getTargetUrl()).addBodyPart(new FilePart("test", file, "application/octet-stream", UTF_8)).execute().get();
assertEquals(response.getStatusCode(), 200);
}
}
use of org.asynchttpclient.request.body.multipart.FilePart in project async-http-client by AsyncHttpClient.
the class FilePartLargeFileTest method testPutImageFile.
@Test(groups = "standalone")
public void testPutImageFile() throws Exception {
try (AsyncHttpClient client = asyncHttpClient(config().setRequestTimeout(100 * 6000))) {
Response response = client.preparePut(getTargetUrl()).addBodyPart(new FilePart("test", LARGE_IMAGE_FILE, "application/octet-stream", UTF_8)).execute().get();
assertEquals(response.getStatusCode(), 200);
}
}
Aggregations