Skip to content

Commit

Permalink
[GITLAB] Support proxy by using HttpClients.createSystem()
Browse files Browse the repository at this point in the history
  • Loading branch information
Roland Oldenburg authored and mc1arke committed May 17, 2020
1 parent 7c88193 commit 0422757
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private <X> X getSingle(String userURL, Map<String, String> headers, Class<X> ty
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpGet.addHeader(entry.getKey(), entry.getValue());
}
HttpResponse httpResponse = HttpClients.createDefault().execute(httpGet);
HttpResponse httpResponse = HttpClients.createSystem().execute(httpGet);
if (null != httpResponse && httpResponse.getStatusLine().getStatusCode() != 200) {
LOGGER.error(httpResponse.toString());
LOGGER.error(EntityUtils.toString(httpResponse.getEntity(), StandardCharsets.UTF_8));
Expand Down Expand Up @@ -232,7 +232,7 @@ private <X> List<X> getPagedList(String commitDiscussionURL, Map<String, String>
List<X> discussions = new ArrayList<>();

if (sendRequest) {
HttpResponse httpResponse = HttpClients.createDefault().execute(httpGet);
HttpResponse httpResponse = HttpClients.createSystem().execute(httpGet);
if (null != httpResponse && httpResponse.getStatusLine().getStatusCode() != 200) {
LOGGER.error(httpResponse.toString());
LOGGER.error(EntityUtils.toString(httpResponse.getEntity(), StandardCharsets.UTF_8));
Expand Down Expand Up @@ -267,7 +267,7 @@ private void deleteCommitDiscussionNote(String commitDiscussionNoteURL, Map<Stri
if (sendRequest) {
LOGGER.info("Deleting {} with headers {}", commitDiscussionNoteURL, headers);

HttpResponse httpResponse = HttpClients.createDefault().execute(httpDelete);
HttpResponse httpResponse = HttpClients.createSystem().execute(httpDelete);
validateGitlabResponse(httpResponse, 204, "Commit discussions note deleted");
}
}
Expand All @@ -283,7 +283,7 @@ private void postCommitComment(String commitCommentUrl, Map<String, String> head
if (sendRequest) {
LOGGER.info("Posting {} with headers {} to {}", params, headers, commitCommentUrl);

HttpResponse httpResponse = HttpClients.createDefault().execute(httpPost);
HttpResponse httpResponse = HttpClients.createSystem().execute(httpPost);
validateGitlabResponse(httpResponse, 201, "Comment posted");
}
}
Expand All @@ -307,7 +307,7 @@ private void postStatus(String statusPostUrl, Map<String, String> headers, Analy
httpPost.addHeader(entry.getKey(), entry.getValue());
}
if (sendRequest) {
HttpResponse httpResponse = HttpClients.createDefault().execute(httpPost);
HttpResponse httpResponse = HttpClients.createSystem().execute(httpPost);
if (null != httpResponse && httpResponse.toString().contains("Cannot transition status")) {
// Workaround for https://gitlab.com/gitlab-org/gitlab-ce/issues/25807
LOGGER.debug("Transition status is already {}", status);
Expand Down

0 comments on commit 0422757

Please sign in to comment.