Skip to content

Commit

Permalink
Merge pull request #87 from square/jw/constant
Browse files Browse the repository at this point in the history
Use constant for Content-Type header name.
  • Loading branch information
kryali committed Oct 29, 2012
2 parents f429e97 + 8b612fa commit b6caa25
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions http/src/main/java/retrofit/http/HttpMethodType.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.apache.http.client.utils.URIUtils;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MIME;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.protocol.HTTP;
Expand Down Expand Up @@ -100,7 +101,7 @@ private static URI getParameterizedUri(HttpRequestBuilder builder)
private static void addHeaders(HttpMessage message, HttpRequestBuilder builder) {
String mimeType = builder.getMimeType();
if (mimeType != null) {
message.addHeader("Content-Type", mimeType);
message.addHeader(MIME.CONTENT_TYPE, mimeType);
}
Headers headers = builder.getHeaders();
if (headers != null) {
Expand Down Expand Up @@ -149,7 +150,7 @@ private static void addParams(HttpEntityEnclosingRequestBase request,
if (builder.getSingleEntity() != null) {
final TypedBytesEntity entity = new TypedBytesEntity(builder.getSingleEntity());
request.setEntity(entity);
request.addHeader("Content-Type", entity.getMimeType().mimeName());
request.addHeader(MIME.CONTENT_TYPE, entity.getMimeType().mimeName());
} else {
List<NameValuePair> paramList = builder.getParamList(true);
// TODO: Use specified encoding. (See CallbackResponseHandler et al)
Expand Down

0 comments on commit b6caa25

Please sign in to comment.