Skip to content

Commit 874d99b

Browse files
committed
Updated files to keep old "request" method (without api key param) for backward compatibility
1 parent dfb588d commit 874d99b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/main/java/com/adyen/httpclient/ClientInterface.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
public interface ClientInterface {
2929

30+
String request(String endpoint, String json, Config config) throws IOException, HTTPClientException;
3031
String request(String endpoint, String json, Config config, boolean isApiKeyRequired) throws IOException, HTTPClientException;
3132
String post(String endpoint, Map<String, String> postParameters, Config config) throws IOException, HTTPClientException;
3233
}

src/main/java/com/adyen/httpclient/HttpURLConnectionClient.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,19 @@ public class HttpURLConnectionClient implements ClientInterface {
3939
private static final String CHARSET = "UTF-8";
4040
private Proxy proxy;
4141

42+
/**
43+
* Does a POST request.
44+
* config is used to obtain basic auth username, password and User-Agent
45+
*/
4246
/**
4347
* Does a POST request.
4448
* config is used to obtain basic auth username, password and User-Agent
4549
*/
50+
@Override
51+
public String request(String requestUrl, String requestBody, Config config) throws IOException, HTTPClientException {
52+
return request(requestUrl, requestBody, config, false);
53+
}
54+
4655
@Override
4756
public String request(String requestUrl, String requestBody, Config config, boolean isApiKeyRequired) throws IOException, HTTPClientException {
4857
HttpURLConnection httpConnection = createRequest(requestUrl, config.getApplicationName());
@@ -150,7 +159,7 @@ private HttpURLConnection setContentType(HttpURLConnection httpConnection, Strin
150159
private HttpURLConnection setApiKey(HttpURLConnection httpConnection, String apiKey) {
151160
if (apiKey != null && !apiKey.isEmpty()) {
152161
httpConnection.setRequestProperty("x-api-key", apiKey);
153-
}
162+
}
154163
return httpConnection;
155164
}
156165

0 commit comments

Comments
 (0)