Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
ZNTA-1178 - fix issue pulling file type project
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Huang committed Jun 16, 2016
1 parent 0741931 commit 9ddc885
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand Down

0 comments on commit 9ddc885

Please sign in to comment.