Forum Discussion

SiKing's avatar
SiKing
Community Expert
6 years ago

read image from a GET response in Groovy script

I am testing a service that uploads images. I upload my image with a POST, and subsequently read it back with a GET. Looking at the GET response in the Outline tab, I see the correct metada: conten...
  • SiKing's avatar
    6 years ago

    This answer and browsing through the SoapUI APIs eventually led me to:

    // received image
    def testStep = testRunner.testCase.testSteps['Read image']
    def image = testStep.testRequest.response
    assert image.getContentType() == "image/jpeg"
    assert image.getContentLength() == fileBytes.size()
    def imageBytes = image.getRawResponseBody()
    def imageDigest = md.digest(imageBytes)
    

    The rest of the code is unchanged.