Skip to content

Commit 7fe5daf

Browse files
committed
Discard response body when fetching digest
Authored-by: Leonhardt Koepsell <[email protected]>
1 parent 3bfc704 commit 7fe5daf

File tree

1 file changed

+8
-6
lines changed
  • src/main/kotlin/dev/codebandits/container/gradle/docker

1 file changed

+8
-6
lines changed

src/main/kotlin/dev/codebandits/container/gradle/docker/Registry.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal object Registry {
1515
val imageReferenceParts = imageReference.toImageReferenceParts()
1616
val httpResponse = run {
1717
val httpRequest = buildRegistryManifestRequest(imageReferenceParts)
18-
httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString())
18+
httpClient.send(httpRequest, HttpResponse.BodyHandlers.discarding())
1919
}
2020

2121
return when (httpResponse.statusCode()) {
@@ -46,11 +46,13 @@ internal object Registry {
4646

4747
return HttpRequest.newBuilder()
4848
.uri(manifestUri)
49-
.header("Accept", listOf(
50-
"application/vnd.oci.image.index.v1+json",
51-
"application/vnd.docker.distribution.manifest.v2+json",
52-
"application/vnd.docker.distribution.manifest.list.v2+json",
53-
).joinToString(", "))
49+
.header(
50+
"Accept", listOf(
51+
"application/vnd.oci.image.index.v1+json",
52+
"application/vnd.docker.distribution.manifest.v2+json",
53+
"application/vnd.docker.distribution.manifest.list.v2+json",
54+
).joinToString(", ")
55+
)
5456
.header("Authorization", "Bearer $registryToken")
5557
.GET()
5658
.build()

0 commit comments

Comments
 (0)