Skip to content

Commit 521d58b

Browse files
committed
Fix regression caused by the fix for AHX 78, thanks to Dominic for his test case
1 parent 56443e2 commit 521d58b

File tree

5 files changed

+544
-3
lines changed

5 files changed

+544
-3
lines changed

pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,19 @@
151151
</exclusions>
152152
</dependency>
153153

154+
<dependency>
155+
<groupId>commons-io</groupId>
156+
<artifactId>commons-io</artifactId>
157+
<version>2.0.1</version>
158+
<scope>test</scope>
159+
</dependency>
160+
<dependency>
161+
<groupId>commons-fileupload</groupId>
162+
<artifactId>commons-fileupload</artifactId>
163+
<version>1.2.2</version>
164+
<scope>test</scope>
165+
</dependency>
166+
154167
<!-- Optional Apache Http Client -->
155168
<dependency>
156169
<groupId>commons-httpclient</groupId>

src/main/java/com/ning/http/client/StringPart.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,20 @@
2020
* A string multipart part.
2121
*/
2222
public class StringPart implements Part {
23-
private String name;
24-
private String value;
23+
private final String name;
24+
private final String value;
25+
private final String charset;
26+
27+
public StringPart(String name, String value, String charset) {
28+
this.name = name;
29+
this.value = value;
30+
this.charset = charset;
31+
}
2532

2633
public StringPart(String name, String value) {
2734
this.name = name;
2835
this.value = value;
36+
this.charset = "UTF-8";
2937
}
3038

3139
public String getName() {
@@ -35,4 +43,9 @@ public String getName() {
3543
public String getValue() {
3644
return value;
3745
}
46+
47+
public String getCharset() {
48+
return charset;
49+
}
50+
3851
}

src/main/java/com/ning/http/util/AsyncHttpProviderUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public final static MultipartRequestEntity createMultipartRequestEntity(List<Par
214214
} else if (part instanceof StringPart) {
215215
parts[i] = new com.ning.http.multipart.StringPart(part.getName(),
216216
((StringPart) part).getValue(),
217-
"UTF-8");
217+
((StringPart) part).getCharset());
218218
} else if (part instanceof FilePart) {
219219
parts[i] = new com.ning.http.multipart.FilePart(part.getName(),
220220
((FilePart) part).getFile(),

0 commit comments

Comments
 (0)