diff --git a/zanata-rest-client/src/main/java/org/zanata/rest/client/InvalidContentTypeFilter.java b/zanata-rest-client/src/main/java/org/zanata/rest/client/InvalidContentTypeFilter.java index 273e2ada..780f0a19 100644 --- a/zanata-rest-client/src/main/java/org/zanata/rest/client/InvalidContentTypeFilter.java +++ b/zanata-rest-client/src/main/java/org/zanata/rest/client/InvalidContentTypeFilter.java @@ -50,9 +50,9 @@ public class InvalidContentTypeFilter extends ClientFilter { "Please check the server URL is correct (in zanata.ini and in zanata.xml) and make sure you use the correct address."; - // we assume only xml or json are the valid types (wildcard type is also considered compatible) + // we assume application/* are all the valid types (wildcard type is also considered compatible) private static final Pattern VALID_TYPES_REGEX = - Pattern.compile("application/.*\\+?(\\*|xml|json)(;.*)?"); + Pattern.compile("application/.*"); @Override public ClientResponse handle(ClientRequest clientRequest) diff --git a/zanata-rest-client/src/test/java/org/zanata/rest/client/InvalidContentTypeFilterTest.java b/zanata-rest-client/src/test/java/org/zanata/rest/client/InvalidContentTypeFilterTest.java index 4de1f1ab..10e3dba2 100644 --- a/zanata-rest-client/src/test/java/org/zanata/rest/client/InvalidContentTypeFilterTest.java +++ b/zanata-rest-client/src/test/java/org/zanata/rest/client/InvalidContentTypeFilterTest.java @@ -49,7 +49,7 @@ public void testValidateContentTypes() { MatcherAssert.assertThat( isContentTypeCompatible( MediaType.APPLICATION_FORM_URLENCODED_TYPE), - equalTo(false)); + equalTo(true)); MatcherAssert.assertThat( isContentTypeCompatible(MediaType.MULTIPART_FORM_DATA_TYPE), equalTo(false)); @@ -60,6 +60,10 @@ public void testValidateContentTypes() { MatcherAssert.assertThat( isContentTypeCompatible(MediaType.APPLICATION_JSON_TYPE), equalTo(true)); + + MatcherAssert.assertThat( + isContentTypeCompatible(MediaType.APPLICATION_OCTET_STREAM_TYPE), + equalTo(true)); MatcherAssert.assertThat( isContentTypeCompatible(MediaType.WILDCARD_TYPE), equalTo(true));