-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
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())); |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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.
var
. Thus, fixed it