Skip to content

Commit

Permalink
Content type was not set on StringEntity's
Browse files Browse the repository at this point in the history
  • Loading branch information
wmathurin committed Apr 25, 2012
1 parent 68e97fc commit cf807b1
Showing 1 changed file with 9 additions and 4 deletions.
Expand Up @@ -59,7 +59,7 @@
*
*/
public class RestRequest {

/**
* Enumeration for all HTTP methods.
*
Expand Down Expand Up @@ -357,8 +357,13 @@ public static RestRequest getRequestForQuery(String apiVersion, String q) throws
*/
private static StringEntity prepareFieldsData(Map<String, Object> fields)
throws UnsupportedEncodingException {
return (fields == null ? null : new StringEntity(new JSONObject(fields).toString(), HTTP.UTF_8));
if (fields == null) {
return null;
}
else {
StringEntity entity = new StringEntity(new JSONObject(fields).toString(), HTTP.UTF_8);
entity.setContentType("application/json");
return entity;
}
}


}

1 comment on commit cf807b1

@wmathurin
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should fix the 6 tests currently failing in SalesforceSDKTest

Please sign in to comment.