Skip to content

Commit

Permalink
Add User-Agent header (#43)
Browse files Browse the repository at this point in the history
I realized this wasn't being set.

Signed-off-by: Jesse Szwedko <[email protected]>
  • Loading branch information
jszwedko authored Apr 14, 2024
1 parent f49031e commit 49d3313
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ private void setRequestProperties(HttpURLConnection con) {
con.setRequestProperty("DD-API-KEY", config.ddApiKey);
con.setRequestProperty("DD-EVP-ORIGIN", Project.getName());
con.setRequestProperty("DD-EVP-ORIGIN-VERSION", Project.getVersion());
con.setRequestProperty("User-Agent", Project.getName() + "/" + Project.getVersion());
}

private byte[] compress(String str) throws IOException {
Expand All @@ -192,4 +193,4 @@ private String getOutput(InputStream input) throws IOException {

return errorOutput.toString(StandardCharsets.UTF_8.name());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public void writer_givenConfigs_sendsPOSTToURL() throws IOException {
Assert.assertTrue(request.getHeaders().contains("DD-API-KEY:" + apiKey));
Assert.assertTrue(request.getHeaders().contains("DD-EVP-ORIGIN:datadog-kafka-connect-logs"));
Assert.assertTrue(request.getHeaders().contains("DD-EVP-ORIGIN-VERSION:" + Project.getVersion()));
Assert.assertTrue(request.getHeaders().contains("User-Agent:datadog-kafka-connect-logs/" + Project.getVersion()));
}

@Test
Expand Down

0 comments on commit 49d3313

Please sign in to comment.