Before I start, I know there is a similar question, but I could not find an adequate answer there.
I’m working on a service that interacts with GitHub using Tentacat library (which then uses HttpPoison to send requests to GitHub servers). I would like to intercept all of those HttpPoison requests before they “leave my service” to add an extra header. I know similar libraries (Axios for React) have this feature of interceptors. Is something like that even possible with HttpPosion?
That was the option I was trying to avoid Maybe I wasn’t specific enough in my last response, I can alter the codebase, but it’s not feasible to replace Tentacat as it is being used all over the place and it would take too much time to create my own GitHub client and switch to it
@sneako@dimitarvp Actually, that allows me only to set headers statically, I can’t use it to add Etag (If-None-Match) which differs for every repository
Looked quickly through tentacat. It seems your only option is to fork it and modify lib/tentacat.ex to do use HTTPoison.Base but with process_request_headers overriden in the same file (lib/tentacat.ex).
That’s the quickest fix I can think of. If not then you should bring a tank to the fist fight and setup a man-in-the-middle proxy to intercept and inject headers.