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

Fix some points to integrate #6

Merged
merged 4 commits into from
Oct 28, 2024
Merged

Fix some points to integrate #6

merged 4 commits into from
Oct 28, 2024

Conversation

Konboi
Copy link
Contributor

@Konboi Konboi commented Oct 25, 2024

  • AFAIR, we'll support Java 1.8 but we used Java 10 idiom var. Thus, fixed it
  • Add token parse method to assemble request url.
  • Add content-type header. Because we adopted gzip compressing.

if (endpoint==null) {
endpoint = DEFAULT_UPLOAD_URL;
}
var hc = new HttpPost(endpoint);
HttpPost hc = new HttpPost(String.format("%s/intake/organizations/%s/workspaces/%s/events/jenkins", endpoint, orgWs.getOrganization(), orgWs.getWorkspace()));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with assembling URL part. Can I use String.format?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this looks great


var builder = MultipartEntityBuilder.create();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not to use Java 10 idiom

builder.addTextBody("metadata", properties.build().toString(), ContentType.APPLICATION_JSON);
builder.addBinaryBody("file", report, ContentType.APPLICATION_XML, "junitResult.xml");

hc.setEntity(new GzipCompressingEntity(builder.build()));
hc.addHeader("Authorization", "Bearer " + apiKey.getPlainText());
hc.setHeader(HttpHeaders.CONTENT_ENCODING, "gzip");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We talked it this part directly, it seems server side can't handle compressed request correctly.

@Konboi Konboi requested a review from kohsuke October 25, 2024 01:26
@kohsuke kohsuke merged commit cfc93e0 into main Oct 28, 2024
1 check failed
@kohsuke kohsuke deleted the for-development branch October 28, 2024 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants