http_interceptor icon indicating copy to clipboard operation
http_interceptor copied to clipboard

Using interceptors on multipart request

Open abdulkash opened this issue 1 year ago • 10 comments

When i use a logging interceptor on a multipart request it returns StreamedResponse and if i listen to this object i get "Bad state exception stream has already been listened to"

abdulkash avatar Apr 11 '23 01:04 abdulkash

Any fix for this ? I am getting the same issue.

mittal-sahab-sudo avatar Jun 05 '23 13:06 mittal-sahab-sudo

Hi, I'm looking into it, however I do this on my spare time, which is definitely not enough. Pull requests are always welcomed though. 😄

CodingAleCR avatar Jun 06 '23 18:06 CodingAleCR

At the moment, the way that you can work with Multipart Requests would be to do something like in the example project. In there, you'll find a way to do requests without necessarily needing to listen to the stream.

I'm still looking for a way to "clone" the stream and data into a new one without having the stream either closed or listened to but it might take me a while to figure out a scalable solution.

CodingAleCR avatar Jul 08 '23 05:07 CodingAleCR

Its the same implementation on the example code that I used but it still has the same issue

abdulkash avatar Jul 08 '23 11:07 abdulkash

What I meant with the example is that you might not need to listen to the stream, or is there any specific reason that you ~~want~~ need to do that?

CodingAleCR avatar Jul 08 '23 22:07 CodingAleCR

When I don't listen to the stream the logged response is StreamedResponse object

abdulkash avatar Jul 09 '23 10:07 abdulkash

Yes, you could work with the StreamedResponse like in the Multipart Request example. You would parse the StreamedResponse to a Response and do what you need with it.

CodingAleCR avatar Jul 09 '23 16:07 CodingAleCR

At least if you don't depend on listen. If you do then I would ask for a bit more patience since I can't look at it at the moment. Sorry it takes too long to get things done!

CodingAleCR avatar Jul 09 '23 16:07 CodingAleCR

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 17 '23 00:09 stale[bot]

Any progress with fixing issue ?

eldarkk avatar Jun 18 '24 11:06 eldarkk