saloonphp / saloon

🤠 Build beautiful API integrations and SDKs with Saloon
https://docs.saloon.dev
MIT License
2.09k stars 107 forks source link

Debugging middleware results in empty body #447

Open ddebowczyk opened 3 months ago

ddebowczyk commented 3 months ago

Turning on debug mode on when interacting with OpenAI API (and other LLM provider APIs) results in empty body for any subsequent code - body is read by Saloon Debugger class, but then cannot be accessed anymore.

I think the reason is that the response body is unseekable and is not (and / or can not) be rewinded.

Is there any standard way of handling debugging in case of unseekable response streams?

ddebowczyk commented 3 months ago

Might be related: https://github.com/guzzle/guzzle/issues/1582