Skip to content

Commit f6513df

Browse files
Thisara-WelmillaJalina2007
authored andcommitted
Improve x-wso2-api-version header resolving
1 parent d426f7b commit f6513df

File tree

1 file changed

+5
-6
lines changed
  • components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/internal/util

1 file changed

+5
-6
lines changed

components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/internal/util/APIClient.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import java.io.IOException;
5050
import java.net.SocketTimeoutException;
5151
import java.nio.charset.StandardCharsets;
52-
import java.util.HashMap;
5352
import java.util.Map;
5453

5554
/**
@@ -88,21 +87,21 @@ public APIClient() {
8887
* @param actionType Action type.
8988
* @param url URL of the API endpoint.
9089
* @param authMethod Authentication method to be used.
91-
* @param headers Headers to be included in the request.
90+
* @param additionalHeaders Headers to be included in the request.
9291
* @param payload Payload to be sent in the request body.
9392
* @return ActionInvocationResponse containing the response or error details.
9493
*/
9594
public ActionInvocationResponse callAPI(ActionType actionType, String url, AuthMethods.AuthMethod authMethod,
96-
Map<String, String> headers, String payload) {
95+
Map<String, String> additionalHeaders, String payload) {
9796

9897
HttpPost httpPost = new HttpPost(url);
99-
setRequestEntity(httpPost, payload, authMethod, headers);
98+
setRequestEntity(httpPost, payload, authMethod, additionalHeaders);
10099

101100
return executeRequest(actionType, httpPost);
102101
}
103102

104103
private void setRequestEntity(HttpPost httpPost, String jsonRequest, AuthMethods.AuthMethod authMethod,
105-
Map<String, String> headers) {
104+
Map<String, String> additionalHeaders) {
106105

107106
StringEntity entity = new StringEntity(jsonRequest, StandardCharsets.UTF_8);
108107
if (authMethod != null) {
@@ -111,7 +110,7 @@ private void setRequestEntity(HttpPost httpPost, String jsonRequest, AuthMethods
111110
httpPost.setEntity(entity);
112111
httpPost.setHeader("Accept", "application/json");
113112
httpPost.setHeader("Content-type", "application/json");
114-
for (Map.Entry<String, String> header : headers.entrySet()) {
113+
for (Map.Entry<String, String> header : additionalHeaders.entrySet()) {
115114
httpPost.setHeader(header.getKey(), header.getValue());
116115
}
117116
}

0 commit comments

Comments
 (0)