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

ENH Add response.text to pyodide.http.FetchResponse #4052

Merged
merged 6 commits into from
Aug 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/py/pyodide/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,18 @@
return await self.js_response.arrayBuffer()

async def string(self) -> str:
"""Return the response body as a string"""
"""Return the response body as a string

Does the same thing as :py:meth:`Response.text`.
"""
self._raise_if_failed()
return await self.js_response.text()

Check warning on line 168 in src/py/pyodide/http.py

View check run for this annotation

Codecov / codecov/patch

src/py/pyodide/http.py#L167-L168

Added lines #L167 - L168 were not covered by tests
hoodmane marked this conversation as resolved.
Show resolved Hide resolved

async def text(self) -> str:
"""Return the response body as a string

Does the same thing as :py:meth:`Response.string`.
"""
self._raise_if_failed()
return await self.js_response.text()

Expand Down