I’m currently struggling to make some checks/validations on multipart responses.
My response consists of two parts, the SOAP response and some binary data (MTOM response).
I.e. the body looks like this:
When I use the bodyString() method, I get only the content of the first part (i.e. the SOAP-Message content starting with <soap:Envelope). The bodyLength() method also takes only the content of the first part into consideration.
The xpath() check on the other hand seems tries to use the whole response and fails, as it is no valid xml.
When using transformResponse(...) method, the response.body contains the whole body starting with --uuid:e0.....
Is there any other way than the transformResponse() to access the second part of the multi-part response and perform some checks on that part?
unfortunately, bodyBytes() returns only the bytes of the first multipart message, i.e. only the SOAP message like bodyString(). Also regex(..) receives only the body of the first part.
The only way I found so far to access the whole message is using the transformResponse() method.
unfortunately, bodyBytes() returns only the bytes of the first multipart message
This is not correct (or it’s a bug, but I doubt that).
bodyBytes() returns the bytes of the full HTTP response body.
bodyString() returns also the full response body, but decoded as chars (with the charset being either from the content-type header or by default, the one defined in Gatling’s conf), which is most likely a mess in your case as your response body is not text.
I.e. the first bodyLength() check returns the length of the whole body, then the body gets reduced, and finally the second check returns the length of the transformed body.
However, it seems that transformResponse is executed first, as both bodyLength() calls returns the same result.