Hello,
I am trying to change the WebSocket payload but getting the error:
"java.lang.ClassCastException: Cannot cast java.lang.String to [Bjava.lang.ClassCastException: Cannot cast java.lang.String to [B"
My script:
function onMessageFrame(msg, helper){
mss = msg.getReadablePayload();
n = mss.indexOf("Red\":500");
if(n > 0) {
newmss = mss.replace("Red\":500", "Red\":100");
msg.setPayload(
newmss
);
}
}
Checked the ZAP code and it seems that setPayload method expect Object, but after replacing the text I am getting String.
public void setPayload(Object payload) {
this.payload = payload;
}
What is the correct method how to change the WebSocket content?