CodingAleCR / http_interceptor

A lightweight, simple plugin that allows you to intercept request and response objects and modify them if desired.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't intercept requests on 'send()' method

chinloyal opened this issue · comments

I am using an API that has an odd DELETE request endpoint where I have to pass a body to it, the default delete method doesn't have an option to pass a body so I have to create a custom request then pass it like this client.send(request), the problem is the interceptor doesn't seem to intercept these requests on the client, and so my default headers are left blank.

Is there a way to intercept this type of request without having to manually add the headers to the custom request?

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

Hmm, to be honest, right now there's no way to achieve this other than extending the class and using your own extension for it. I do plan to support the send method call, right now it's mostly an escape hatch and not fully supported. I'm sorry that I cannot be of more assistance with your case, but I'd be down to a call if you need it. Cheers and thanks for the issue!

I have added this to the backlog, I will close the issue now.

commented

I faced the same problem. Headers were not attached to send call

Hi, yes, as pointed in the plugin's read me, the usage of the send method is not supported yet, I am working to achieve this, it takes quite an effort since I might need to clone every type of request to properly intercept it. I'm sorry for the many inconveniences this has caused.

Using send method was added on #98 and to the 2.0.0 beta, feel free to try it out if you want ;)