Package org.asynchttpclient.multipart

Examples of org.asynchttpclient.multipart.ByteArrayPart


            builder.addBodyPart(new StringPart("Age", "3"));
            builder.addBodyPart(new StringPart("Height", "shrimplike"));
            builder.addBodyPart(new StringPart("Hair", "ridiculous"));

            builder.addBodyPart(new ByteArrayPart("file4", expectedContents.getBytes(UTF_8), "text/plain", UTF_8, "bytearray.txt"));

            Request r = builder.build();

            Response res = c.executeRequest(r).get();
View Full Code Here


    @Test(groups = { "standalone", "default_provider" })
    public void testMultiPartPut() throws Exception {
        SimpleAsyncHttpClient client = new SimpleAsyncHttpClient.Builder().setProviderClass(getProviderClass()).setUrl(getTargetUrl() + "/multipart").build();
        try {
            Response response = client.put(new ByteArrayPart("baPart", "testMultiPart".getBytes(UTF_8), "application/test", UTF_8, "fileName")).get();

            String body = response.getResponseBody();
            String contentType = response.getHeader("X-Content-Type");

            assertTrue(contentType.contains("multipart/form-data"));
View Full Code Here

    @Test(groups = { "standalone", "default_provider" })
    public void testMultiPartPost() throws Exception {
        SimpleAsyncHttpClient client = new SimpleAsyncHttpClient.Builder().setProviderClass(getProviderClass()).setUrl(getTargetUrl() + "/multipart").build();
        try {
            Response response = client.post(new ByteArrayPart("baPart", "testMultiPart".getBytes(UTF_8), "application/test", UTF_8, "fileName")).get();

            String body = response.getResponseBody();
            String contentType = response.getHeader("X-Content-Type");

            assertTrue(contentType.contains("multipart/form-data"));
View Full Code Here

TOP

Related Classes of org.asynchttpclient.multipart.ByteArrayPart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.