Skip to content

Commit

Permalink
change /view/scan to post
Browse files Browse the repository at this point in the history
Signed-off-by: munishchouhan <[email protected]>
  • Loading branch information
munishchouhan committed Feb 27, 2025
1 parent 206881e commit 3b55ec7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ import io.micronaut.core.annotation.Nullable
import io.micronaut.http.HttpRequest
import io.micronaut.http.HttpResponse
import io.micronaut.http.HttpStatus
import io.micronaut.http.annotation.Body
import io.micronaut.http.annotation.Controller
import io.micronaut.http.annotation.Get
import io.micronaut.http.annotation.Post
import io.micronaut.http.annotation.QueryValue
import io.micronaut.http.client.HttpClient
import io.micronaut.http.client.annotation.Client
Expand Down Expand Up @@ -315,8 +317,8 @@ class ViewController {
* @return
* The redirect response to the scan view for the requested container image
*/
@Get('/scans')
Publisher<HttpResponse> requestScan(@QueryParam String image) {
@Post('/scans')
Publisher<HttpResponse> requestScan(@Body String image) {
final req = new SubmitContainerTokenRequest(containerImage: image, scanMode: ScanMode.required)
final post = HttpRequest.POST("/v1alpha2/container", req)
final resp = httpClient.retrieve(post, SubmitContainerTokenResponse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,8 @@ class ViewControllerTest extends Specification {
def image = "ubuntu:latest"
and:
def req = java.net.http.HttpRequest.newBuilder()
.GET()
.uri(new URI("${uri}/view/scans?image=${image}"))
.POST(java.net.http.HttpRequest.BodyPublishers.ofByteArray(image.bytes))
.uri(new URI("${uri}/view/scans"))
.build()

when:
Expand Down

0 comments on commit 3b55ec7

Please sign in to comment.