Hi,
What information do you use to persist on the request event? I see you use the persist add uie command on HTTP_RESPONDE_SEND but you still need to persist in the HTTP_REQUEST by using persist uie . I don't know if that's coming in a HTTP header o cookie. You need that to persist.
Regarding chunking, instead of doing the transformations on the HTTP protocol, maybe is worth for you to try to configure an specific HTTP profile with option chuncked content to rechunk. This way you will have the whole response ready to inspect automatically: https://support.f5.com/csp/article/K5379