Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output the response body when request returns a 400 #190

Open
JelleZijlstra opened this issue Dec 7, 2022 · 1 comment
Open

Output the response body when request returns a 400 #190

JelleZijlstra opened this issue Dec 7, 2022 · 1 comment

Comments

@JelleZijlstra
Copy link

  • Python version: 3.9
  • Operating System: Ubuntu
  • aiohttp version: 3.7.4

I made a request to an SSE endpoint and I hit a 400, but the error just looks like ConnectionError: fetch https://example.com/ failed: 400. To figure out what caused the 400, I had to patch aiohttp-sse-client to include the response body in the error.

It would be useful if the library provided a way to access the response body directly for cases like this. Perhaps the exceptions it throws could include the aiohttp ClientResponse object as an attribute, so callers can call e.response.read() if desired.

@JelleZijlstra
Copy link
Author

I created a fork in https://github.com/JelleZijlstra/aiohttp-sse-client2 to fix this issue since development on this repo seems to have stalled. I'll be happy to retire my fork if this repo comes back to life.

If other aiohttp-sse-client users have fixes they'd like to see, feel free to submit them to my fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant