Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GITLAB] Support proxy by using HttpClients.createSystem() #155

Merged
merged 1 commit into from
May 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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