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

Raise errors from the server #25

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/httpx_sse/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def response(self) -> httpx.Response:
return self._response

def iter_sse(self) -> Iterator[ServerSentEvent]:
self._response.raise_for_status()
self._check_content_type()
decoder = SSEDecoder()
for line in self._response.iter_lines():
Expand All @@ -34,6 +35,7 @@ def iter_sse(self) -> Iterator[ServerSentEvent]:
yield sse

async def aiter_sse(self) -> AsyncIterator[ServerSentEvent]:
self._response.raise_for_status()
self._check_content_type()
decoder = SSEDecoder()
async for line in self._response.aiter_lines():
Expand Down
Loading