Convert curl request to SoapUI Request
I'm currently trying to convert a working curl command to a valid SoapUI test case but am having some issues. I am trying to attach a json file and the server also requires authorisation. I'm able to configure the authorisation correctly but when comparing the raw packet of both curl and SoapUI, it seems that SoapUI seems to be adding this to the header:
Content-Type: application/json; name="file"
where as the curl request has:
Content-Type: application/json
Is there a way to edit this part of the header?
Alternatively is another way to make this work?
EDIT: just a bit more info about my test case. To replicate the curl request, I have added the attachment and checked the 'Cached' box. I have seen other questions which say that the 'Name' field should be the full path (C:/etc/etc) and others that do not specify this. I have tried both to no avail. 'Content type' is set to application/json as this is what comes up in the curl request and the 'ContentID' = attachment. I have then added a parameter with the 'Name' = attachment, 'Value' = file:*filename* (without the path), 'Style' = QUERY and 'Level' = RESOURCE. 'Media Type is multipart/form-data, 'PostQueryString' box is checked as well and 'Method' set to POST.
The workaround to perform is to remove the name via Groovy. You can change it by using the below Groovy script in event handler FilterRequest.filterRequest:
def bodyPart1 = context.getProperty("httpMethod").requestEntity.message.content.getBodyPart(0)
bodyPart1.removeHeader("Content-Type")
bodyPart1.addHeader("Content-Type","application/json")