Skip to content

Commit

Permalink
chore(vulnerable-code): Make the API version part of the base URL
Browse files Browse the repository at this point in the history
Avoid to adjust all endpoints on API version change.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Nov 15, 2024
1 parent a974802 commit 45b40d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ import retrofit2.http.POST
*/
interface VulnerableCodeService {
companion object {
const val PUBLIC_SERVER_URL = "https://public.vulnerablecode.io"
/**
* The URL to version 1 of the API. Version 2 is currently in the works.
*/
const val PUBLIC_SERVER_URL = "https://public.vulnerablecode.io/api/"

/**
* The JSON (de-)serialization object used by this service.
Expand Down Expand Up @@ -165,6 +168,6 @@ interface VulnerableCodeService {
* Return a list with information about packages including the resolved and unresolved vulnerabilities for these
* packages.
*/
@POST("api/packages/bulk_search")
@POST("packages/bulk_search")
suspend fun getPackageVulnerabilities(@Body packageUrls: PackagesWrapper): List<PackageVulnerabilities>
}
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ private val packagesRequestJson = generatePackagesRequest()
*/
private fun WireMockServer.stubPackagesRequest(responseFile: String, request: String = packagesRequestJson) {
stubFor(
post(urlPathEqualTo("/api/packages/bulk_search"))
post(urlPathEqualTo("/packages/bulk_search"))
.withRequestBody(
equalToJson(request, /* ignoreArrayOrder = */ true, /* ignoreExtraElements = */ false)
)
Expand Down

0 comments on commit 45b40d8

Please sign in to comment.