Github user GERey commented on a diff in the pull request:
https://github.com/apache/incubator-usergrid/pull/232#discussion_r28729413
--- Diff:
stack/rest/src/test/java/org/apache/usergrid/rest/filters/ContentTypeResourceIT.java
---
@@ -105,106 +75,84 @@ public void correctHeaders() throws Exception {
*/
@Test
public void textPlainContentType() throws Exception {
- Map<String, String> data = hashMap( "name", "Solitaire2" );
-
- String json = JsonUtils.mapToFormattedJsonString( data );
-
- DefaultHttpClient client = new DefaultHttpClient();
-
- HttpHost host = new HttpHost( super.getBaseURI().getHost(),
super.getBaseURI().getPort() );
+ refreshIndex();
+ String json = JsonUtils.mapToFormattedJsonString(hashMap("name",
"Solitaire2"));
+ WebResource.Builder builder =
app().collection("games").getResource(true, getAdminToken())
+ .accept(MediaType.APPLICATION_JSON)
+ .type(MediaType.APPLICATION_JSON);
- HttpPost post = new HttpPost( String.format( "/%s/%s/games",
context.getOrgUuid(), context.getAppUuid() ) );
- post.setEntity( new StringEntity( json ) );
- post.setHeader( HttpHeaders.AUTHORIZATION, "Bearer " +
context.getActiveUser().getToken() );
- post.setHeader( HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON );
- post.setHeader( HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN );
+ ClientResponse clientResponse = builder.post(ClientResponse.class,
json);
--- End diff --
Is there a reason this couldn't use the POST command you specified in the
named resource?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---