Response phase not working in custom plugin. How to modify status and body conditionally?

Hi

I’m trying to write a custom plugin and trying to modify the body & status on basis of current status.
When I write body_filter I can change body & in header_filter I can change status. But I can’t conditionally change both. As in body_filter, can’t change status and in header_filter no body is there.

I tried with response phase and it is not getting executed and as per doc, it is replacement for both the phases.