diff --git a/metricshub-agent/src/main/java/org/sentrysoftware/metricshub/cli/http/HttpCli.java b/metricshub-agent/src/main/java/org/sentrysoftware/metricshub/cli/http/HttpCli.java index c20b4bd8f..d518112f3 100644 --- a/metricshub-agent/src/main/java/org/sentrysoftware/metricshub/cli/http/HttpCli.java +++ b/metricshub-agent/src/main/java/org/sentrysoftware/metricshub/cli/http/HttpCli.java @@ -249,7 +249,7 @@ public String getHeaderContent() throws IOException { StringBuilder header = new StringBuilder(); if (headers != null) { - headers.forEach((key, value) -> header.append(String.format("%s: %s%s", key, value, System.lineSeparator()))); + headers.forEach((key, value) -> header.append(String.format("%s: %s\n", key, value))); return header.toString(); } else if (headerFile != null) { header.append(Files.readString(Path.of(headerFile), StandardCharsets.UTF_8)); diff --git a/metricshub-agent/src/test/java/org/sentrysoftware/metricshub/cli/http/HttpCliTest.java b/metricshub-agent/src/test/java/org/sentrysoftware/metricshub/cli/http/HttpCliTest.java index def971d76..5115538cf 100644 --- a/metricshub-agent/src/test/java/org/sentrysoftware/metricshub/cli/http/HttpCliTest.java +++ b/metricshub-agent/src/test/java/org/sentrysoftware/metricshub/cli/http/HttpCliTest.java @@ -56,7 +56,7 @@ void testGetQuery() { httpCli.setAuthenticationToken(AUTHENTICATION_TOKEN); StringBuilder header = new StringBuilder(); - HEADERS.forEach((key, value) -> header.append(String.format("%s: %s%s", key, value, System.lineSeparator()))); + HEADERS.forEach((key, value) -> header.append(String.format("%s: %s\n", key, value))); ObjectNode queryNode = JsonNodeFactory.instance.objectNode(); queryNode.set("method", new TextNode(HTTP_GET)); @@ -72,8 +72,7 @@ void testGetQuery() { void testGetHeader() throws Exception { initCli(); httpCli.setHeaders(HEADERS); - String expectedHeaderContent = String.format("Content-Type: application/xml%s", System.lineSeparator()); - assertEquals(expectedHeaderContent, httpCli.getHeaderContent()); + assertEquals("Content-Type: application/xml\n", httpCli.getHeaderContent()); httpCli.setHeaders(null); httpCli.setHeaderFile(HEADER_FILE_PATH); assertEquals(FILE_HEADER, httpCli.getHeaderContent());