How to test APIs having multipart/related Content-Type and form data of type application/dicom in Karate

Viewed 18

I need to write a feature file using Karate that tests an DICOM STOW API having Content-Type value as multipart/related and taken formdata input as application/dicom. The equivalent CURL command is working fine, however, when the same option is tried in Karate scenario, it's failing. Could someone help here what's going wrong with my scenario?

Working Curl Command -

curl -X POST -i https://abcd.com/studies -H "Content-Type: multipart/related" -H "Authorization: Bearer xxxx” -F "content=@test.dcm; type=application/dicom"

Equivalent scenario in my feature file is,

  Background:
    * def filePath = read('../../../resources/TestData/test.dcm')

  Scenario: Multipart DICOM upload test
    And header Content-Type = 'multipart/related'
    And header Authorization = 'Bearer '+ xxxx
    And header API-version = 1
    And multipart file content = {value: '#(filePath)', filename: 'test.dcm', contentType= 'application/dicom'}
    When method post
    Then status 200

The error I get from Karate is - net.minidev.json.parser.ParseException: Unexpected End Of File position 79: null

1 Answers
Related