Skip to content

Commit

Permalink
Improve #883
Browse files Browse the repository at this point in the history
  • Loading branch information
slandelle committed May 15, 2015
1 parent 2858f8f commit 2c0e384
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions api/src/main/java/org/asynchttpclient/multipart/PartBase.java
Expand Up @@ -18,8 +18,9 @@
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;


import org.asynchttpclient.FluentStringsMap;
import org.asynchttpclient.Param; import org.asynchttpclient.Param;


public abstract class PartBase implements Part { public abstract class PartBase implements Part {
Expand Down Expand Up @@ -57,7 +58,7 @@ public abstract class PartBase implements Part {
/** /**
* Additional part headers * Additional part headers
*/ */
private FluentStringsMap customHeaders; private List<Param> customHeaders;


/** /**
* Constructor. * Constructor.
Expand Down Expand Up @@ -127,7 +128,7 @@ protected void visitContentIdHeader(PartVisitor visitor) throws IOException {


protected void visitCustomHeaders(PartVisitor visitor) throws IOException { protected void visitCustomHeaders(PartVisitor visitor) throws IOException {
if (isNonEmpty(customHeaders)) { if (isNonEmpty(customHeaders)) {
for (Param param: customHeaders.toParams()) { for (Param param: customHeaders) {
visitor.withBytes(CRLF_BYTES); visitor.withBytes(CRLF_BYTES);
visitor.withBytes(param.getName().getBytes(US_ASCII)); visitor.withBytes(param.getName().getBytes(US_ASCII));
visitor.withBytes(param.getValue().getBytes(US_ASCII)); visitor.withBytes(param.getValue().getBytes(US_ASCII));
Expand Down Expand Up @@ -251,8 +252,8 @@ public void setDispositionType(String dispositionType) {


public void addCustomHeader(String name, String value) { public void addCustomHeader(String name, String value) {
if (customHeaders == null) { if (customHeaders == null) {
customHeaders = new FluentStringsMap(); customHeaders = new ArrayList<Param>(2);
} }
customHeaders.add(name, value); customHeaders.add(new Param(name, value));
} }
} }

0 comments on commit 2c0e384

Please sign in to comment.