Skip to content

Commit 75035ae

Browse files
committed
feat: #248 Fix a bad endpoint for downloading remote artifacts
Signed-off-by: Laurent Broudoux <laurent.broudoux@gmail.com>
1 parent 362a7d7 commit 75035ae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/io/github/microcks/testcontainers/MicrocksContainer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ private void importArtifact(String artifactPath, boolean mainArtifact) {
856856
private static void downloadArtifact(String microcksContainerHttpEndpoint, RemoteArtifact remoteArtifact, boolean mainArtifact) throws ArtifactLoadException {
857857
try {
858858
// Use the artifact/download endpoint to download the artifact.
859-
URL url = new URL(microcksContainerHttpEndpoint + "/api/import");
859+
URL url = new URL(microcksContainerHttpEndpoint + "/api/artifact/download");
860860
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
861861
httpConn.setUseCaches(false);
862862
httpConn.setRequestMethod("POST");
@@ -970,7 +970,7 @@ private static HttpURLConnection uploadFileToMicrocks(URL microcksApiURL, File f
970970
httpConn.setUseCaches(false);
971971
httpConn.setDoOutput(true);
972972
httpConn.setDoInput(true);
973-
httpConn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
973+
httpConn.setRequestProperty(HTTP_CONTENT_TYPE, "multipart/form-data; boundary=" + boundary);
974974

975975
try (OutputStream os = httpConn.getOutputStream();
976976
PrintWriter writer = new PrintWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8), true);
@@ -980,7 +980,7 @@ private static HttpURLConnection uploadFileToMicrocks(URL microcksApiURL, File f
980980
.append(HTTP_UPLOAD_LINE_FEED)
981981
.append("Content-Disposition: form-data; name=\"file\"; filename=\"" + file.getName() + "\"")
982982
.append(HTTP_UPLOAD_LINE_FEED)
983-
.append("Content-Type: " + contentType)
983+
.append(HTTP_CONTENT_TYPE + ": " + contentType)
984984
.append(HTTP_UPLOAD_LINE_FEED)
985985
.append("Content-Transfer-Encoding: binary")
986986
.append(HTTP_UPLOAD_LINE_FEED)

0 commit comments

Comments
 (0)