Skip to content

Commit

Permalink
TEIIDDES-2359 added check so REST connection profile test applies JSON
Browse files Browse the repository at this point in the history
"application/json" ACCEPT value correctly
  • Loading branch information
blafond committed Feb 4, 2015
1 parent cc5ee16 commit 16cdc65
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ public static Exception testURLConnection(IConnectionProfile connectionProfile,
Properties connProperties = connectionProfile.getBaseProperties();
// InputStream not provided, check XML file
String xmlFile = connProperties == null ? null : (String) connProperties.get(propertyKey);
String responseType = IWSProfileConstants.XML;
if( connProperties != null ) {
if( connProperties.get(IWSProfileConstants.RESPONSE_TYPE_PROPERTY_KEY) != null) {
responseType = (String)connProperties.get(IWSProfileConstants.RESPONSE_TYPE_PROPERTY_KEY);
}
}

try {
URL url = URLHelper.buildURL(xmlFile);
Expand All @@ -59,7 +65,12 @@ public static Exception testURLConnection(IConnectionProfile connectionProfile,
if( connProperties.get(IWSProfileConstants.ACCEPT_PROPERTY_KEY) != null ) {
connPropMap.put(IWSProfileConstants.ACCEPT_PROPERTY_KEY, (String)connProperties.get(IWSProfileConstants.ACCEPT_PROPERTY_KEY));
} else {
connPropMap.put(IWSProfileConstants.ACCEPT_PROPERTY_KEY, IWSProfileConstants.ACCEPT_DEFAULT_VALUE);
if( responseType.equalsIgnoreCase(IWSProfileConstants.JSON) ) {
connPropMap.put(IWSProfileConstants.ACCEPT_PROPERTY_KEY, IWSProfileConstants.CONTENT_TYPE_JSON_VALUE);
} else {
connPropMap.put(IWSProfileConstants.ACCEPT_PROPERTY_KEY, IWSProfileConstants.ACCEPT_DEFAULT_VALUE);
}

}

if( connProperties.get(IWSProfileConstants.CONTENT_TYPE_PROPERTY_KEY) != null ) {
Expand Down

0 comments on commit 16cdc65

Please sign in to comment.