My consideration is I dont want to change my legacy API. Even if I could it would lead to redundant endpoint with just different (filtered or stripped) responses.
Say actual my end point returns
I have specific case where I need to return key1 and key2 for one customer, key2 and key3 for another and so.
I can assign different policy to each customer and based on the policy can I dynamically change the response body in production without having to do any change to my API. Tyk config change alone shall suffice.
Tyk body transform golang templates does the job for me. But I just need the policy to the available in the response chain back to the caller. Policy is available in the session. Can I get the session data in response chain to do the required transformation? Can I use some name space?
Also middleware doc says it works on the request chain? I think it cannot used for the response processing. Please correct me if I am wrong.