Skip to content

Commit

Permalink
Get and pass response id when asserting request. (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed Dec 30, 2017
1 parent e8e6d97 commit ada4dc5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/com/bunq/sdk/http/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.bunq.sdk.context.ApiContext;
import com.bunq.sdk.context.InstallationContext;
import com.bunq.sdk.exception.ApiException;
import com.bunq.sdk.exception.BunqException;
import com.bunq.sdk.exception.ExceptionFactory;
import com.bunq.sdk.exception.UncaughtExceptionError;
import com.bunq.sdk.json.BunqGsonBuilder;
Expand Down Expand Up @@ -44,7 +45,6 @@
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.util.EntityUtils;

Expand Down Expand Up @@ -237,13 +237,12 @@ private BunqResponseRaw createBunqResponseRaw(CloseableHttpResponse response)
Integer responseCode = response.getStatusLine().getStatusCode();
byte[] responseBodyBytes = EntityUtils.toByteArray(response.getEntity());

assertResponseSuccess(responseCode, responseBodyBytes);
assertResponseSuccess(responseCode, responseBodyBytes, getResponseId(response));
validateResponseSignature(responseCode, responseBodyBytes, response);

return new BunqResponseRaw(responseBodyBytes, getHeadersMap(response));
}

private static void assertResponseSuccess(int responseCode, byte[] responseBodyBytes) {
private static String getResponseId(CloseableHttpResponse response) {
Map<String, String> headerMap = getHeadersMap(response);

Expand Down

0 comments on commit ada4dc5

Please sign in to comment.