aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/java/fi/iki/elonen/integration/GetAndPostIntegrationTest.java
diff options
context:
space:
mode:
authorhoelzlwimmerf <hoelzlwimmerf@Desktop01.fritz.box>2015-10-18 13:14:03 +0200
committerhoelzlwimmerf <hoelzlwimmerf@Desktop01.fritz.box>2015-10-18 13:14:03 +0200
commitb1397a17955961e2260172f5abf5ec2f4ba54709 (patch)
tree608ae5d68ecb862d14b2ebb022398962eb54da65 /core/src/test/java/fi/iki/elonen/integration/GetAndPostIntegrationTest.java
parente316510734c3e986f89155e0a3916ae6c5167395 (diff)
parenta86bc4b8d23f1d481ea7781f86b88eeb2e3e2546 (diff)
downloadnanohttpd-b1397a17955961e2260172f5abf5ec2f4ba54709.tar.gz
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'core/src/test/java/fi/iki/elonen/integration/GetAndPostIntegrationTest.java')
-rw-r--r--core/src/test/java/fi/iki/elonen/integration/GetAndPostIntegrationTest.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/core/src/test/java/fi/iki/elonen/integration/GetAndPostIntegrationTest.java b/core/src/test/java/fi/iki/elonen/integration/GetAndPostIntegrationTest.java
index d4fc5cf..d2f5181 100644
--- a/core/src/test/java/fi/iki/elonen/integration/GetAndPostIntegrationTest.java
+++ b/core/src/test/java/fi/iki/elonen/integration/GetAndPostIntegrationTest.java
@@ -35,6 +35,7 @@ package fi.iki.elonen.integration;
import static org.junit.Assert.assertEquals;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -154,4 +155,27 @@ public class GetAndPostIntegrationTest extends IntegrationTestBase<GetAndPostInt
assertEquals("GET:testSimpleGetRequest", responseBody);
}
+
+ @Test
+ public void testPostRequestWithMultipartExtremEncodedParameters() throws Exception {
+ this.testServer.response = "testPostRequestWithMultipartEncodedParameters";
+
+ HttpPost httppost = new HttpPost("http://localhost:8192/");
+ MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE, "sfsadfasdf", Charset.forName("UTF-8"));
+ reqEntity.addPart("specialString", new StringBody("拖拉图片到浏览器,可以实现预览功能", "text/plain", Charset.forName("UTF-8")));
+ reqEntity.addPart("gender", new StringBody("图片名称", Charset.forName("UTF-8")) {
+
+ @Override
+ public String getFilename() {
+ return "图片名称";
+ }
+ });
+ httppost.setEntity(reqEntity);
+
+ ResponseHandler<String> responseHandler = new BasicResponseHandler();
+ String responseBody = this.httpclient.execute(httppost, responseHandler);
+
+ // assertEquals("POST:testPostRequestWithMultipartEncodedParameters-params=2;age=120;gender=Male",
+ // responseBody);
+ }
}