Skip to content
Browse files

Merge pull request #21 from forcedotcom/json_content_type_test_failures

Content type was not set on StringEntity's
  • Loading branch information...
2 parents 11bce11 + cf807b1 commit fada5758501b88e37538cc190efea93134ebc11d @wmathurin wmathurin committed Apr 25, 2012
Showing with 9 additions and 4 deletions.
  1. +9 −4 native/SalesforceSDK/src/com/salesforce/androidsdk/rest/RestRequest.java
View
13 native/SalesforceSDK/src/com/salesforce/androidsdk/rest/RestRequest.java
@@ -59,7 +59,7 @@
*
*/
public class RestRequest {
-
+
/**
* Enumeration for all HTTP methods.
*
@@ -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;
+ }
}
-
-
}

0 comments on commit fada575

Please sign in to comment.
Something went wrong with that request. Please try again.