Contributions
SoapUI Rest Mock. Parse multipart body part using groovy
This is the request coming to SOAP UI REST Mock server I have created: (Note this is being sent as form-data Please see the atatchement) POST /CreateHouseholdExt HTTP/1.1 Content-Length: 1580 Content-Type: multipart/form-data; boundary=0NUkKItdTNch66-cGXwMAAdodhTSEs6D8w Host: XX.XX.XX.XX:3002 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.5.1 (Java/1.7.0_261) Accept-Encoding: gzip,deflate --0NUkKItdTNch66-cGXwMAAdodhTSEs6D8w Content-Disposition: form-data; name="NAME1" Content-Type: application/json; charset=UTF-8 Content-Transfer-Encoding: 8bit { "hhStatus":"ENABLED", "accntCode": "1233455-444", } --0NUkKItdTNch66-cGXwMAAdodhTSEs6D8w Content-Disposition: form-data; name="NAME2" Content-Type: application/json; charset=UTF-8 Content-Transfer-Encoding: 8bit { "username": "admin", "phone": "1234444454" } --0NUkKItdTNch66-cGXwMAAdodhTSEs6D8w How to parse it using groovy script? I used as def requestBody = mockRequest.getRequestContent() log.info "Request body: " + requestBody But it is returning null, as the body is coming as form-data. (Message I am getting: Wed Nov 09 23:43:06 IST 2022:INFO:Request body: null) Is there any way to parse the above request, at least print the body?517Views0likes0Comments