Skip to content

Commit

Permalink
copy changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ibalosh committed Dec 19, 2022
1 parent 4cdd85a commit 3c3de46
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main/java/com/postmarkapp/postmark/client/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ public HttpClient(MultivaluedMap<String,Object> headers) {
* @return response from HTTP request
*/
public ClientResponse execute(REQUEST_TYPES requestType, String url, String data) {
String httpUrl = getSecureUrl(url);
Response response;
WebTarget target = client.target(httpUrl);
WebTarget target = client.target(getHttpUrl(url));

switch (requestType) {
case POST:
Expand Down Expand Up @@ -90,7 +89,7 @@ public ClientResponse execute(REQUEST_TYPES requestType, String url, String data

}

return prettifyResponse(response);
return transformResponse(response);
}

/**
Expand Down Expand Up @@ -120,7 +119,7 @@ public void setSecureConnection(boolean secureConnection) {
this.secureConnection = secureConnection;
}

private String getSecureUrl(String url) {
private String getHttpUrl(String url) {
String urlPrefix = this.secureConnection ? "https://" : "http://";
return urlPrefix + url;
}
Expand All @@ -140,7 +139,7 @@ public Client getClient() {
* @param response HTTP request response result
* @return simplified HTTP request response
*/
private ClientResponse prettifyResponse(Response response) {
private ClientResponse transformResponse(Response response) {
return new ClientResponse(response.getStatus(), response.readEntity(String.class));
}

Expand Down Expand Up @@ -175,5 +174,4 @@ public enum REQUEST_TYPES {
PATCH,
DELETE
}

}

0 comments on commit 3c3de46

Please sign in to comment.