Skip to content

Commit

Permalink
Merge pull request #12151 from HeshanSudarshana/master-advance-endpoi…
Browse files Browse the repository at this point in the history
…nt-config

Preserve advanceEndpointConfig when setting endpoint config
  • Loading branch information
HeshanSudarshana authored Sep 15, 2023
2 parents 4ca0bd2 + b20d5dd commit 49a131c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,8 @@ private ConfigParameters() {
public static final String X_WSO2_REQUEST_INTERCEPTOR = "x-wso2-request-interceptor";
public static final String X_WSO2_RESPONSE_INTERCEPTOR = "x-wso2-response-interceptor";
public static final String X_WSO2_ENDPOINT_TYPE = "type";
public static final String ADVANCE_ENDPOINT_CONFIG = "advanceEndpointConfig";
public static final String TIMEOUT_IN_MILLIS = "timeoutInMillis";

//API Constants
public static final String API_DATA_NAME = "name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1388,6 +1388,17 @@ private static ObjectNode setPrimaryConfig(JSONObject endpointConfig, boolean is
ObjectNode endpointResult = objectMapper.createObjectNode();
endpointResult.set(APIConstants.ENDPOINT_URLS, endpointsArray);
endpointResult.put(APIConstants.X_WSO2_ENDPOINT_TYPE, type);
if (primaryEndpoints.has(APIConstants.ADVANCE_ENDPOINT_CONFIG)
&& primaryEndpoints.get(APIConstants.ADVANCE_ENDPOINT_CONFIG) != JSONObject.NULL) {
JSONObject advanceEndpointConfig = primaryEndpoints.getJSONObject(APIConstants.ADVANCE_ENDPOINT_CONFIG);
ObjectNode advanceEndpointsObject = objectMapper.createObjectNode();
if (advanceEndpointConfig.has(APIConstants.TIMEOUT_IN_MILLIS)
&& advanceEndpointConfig.get(APIConstants.TIMEOUT_IN_MILLIS) != JSONObject.NULL) {
advanceEndpointsObject.put(APIConstants.TIMEOUT_IN_MILLIS,
advanceEndpointConfig.getInt(APIConstants.TIMEOUT_IN_MILLIS));
endpointResult.set(APIConstants.ADVANCE_ENDPOINT_CONFIG, advanceEndpointsObject);
}
}
return endpointResult;
}
return null;
Expand Down

0 comments on commit 49a131c

Please sign in to comment.