In my angular + closure project, I'm looking to selectively transform / intercept requests without affecting all of them in order to convert camelCase keys to snake_case.
While I successfully added default interceptors and transformers through $httpProvider in my config, it impacted all requests, including templates. I explored adding an option to each Resource config to control the transforms but this option was only accessible in requests, not responses, leading to the need to check if it's JSON first which is less than ideal.
I also encountered challenges where the interceptor for $resource restricts to response and responseError interceptors, making it frustrating to work with.
My goal is to find a way to intercept each request/response JSON object and keep the transformers organized in their own file/class/factory while allowing flexibility on when to use them.
What would be the most effective approach to achieve this?