in sonatype-apis/src/commonMain/kotlin/org/jetbrains/packagesearch/security/SonatypeApis.kt [66:88]
public suspend fun getVulnerabilities(
request: VulnerabilityRequest,
authUrl: Boolean = false,
): List<SonatypeVulnerabilityResponse> {
val url =
buildUrl {
protocol = URLProtocol.HTTPS
host = "ossindex.sonatype.org"
pathSegments =
buildList {
addAll("api", "v3")
if (authUrl) add("authorized")
add("component-report")
}
}
val httpResponse =
httpClient.post(url) {
setBody(request)
contentType(ContentType.Application.Json)
accept(ContentType.Application.Json)
}
return httpResponse.body<List<SonatypeVulnerabilityResponse>>()
}