CodingAleCR / http_interceptor

A lightweight, simple plugin that allows you to intercept request and response objects and modify them if desired.
MIT License
134 stars 67 forks source link

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

Closed chinloyal closed 3 years ago

chinloyal commented 4 years ago

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[bot] commented 4 years ago

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

CodingAleCR commented 4 years ago

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!

CodingAleCR commented 3 years ago

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

sunnykinger commented 3 years ago

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

CodingAleCR commented 3 years ago

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.

CodingAleCR commented 2 years ago

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