Skip to content

Commit f31eceb

Browse files
committed
Merge branch 'main' of github.com:koenvo/pyodide-http
2 parents c2ea08b + 456348b commit f31eceb

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,4 @@ Currently the following packages can be patched:
5656
`pyodide-http` is used by a some awesome projects:
5757
- [Pyodide](https://github.com/pyodide/pyodide) - included as a standard package
5858
- [Panel](https://github.com/holoviz/panel) - included since 0.14.1 (can be disabled) when running Panel in the Browser using WASM. [Read more](https://panel.holoviz.org/user_guide/Running_in_Webassembly.html#handling-http-requests)
59+
- [Marimo](https://marimo.io/) - used to make basic http requests work

pyodide_http/_core.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,12 @@ def send(request: Request, stream: bool = False) -> Response:
118118
if name.lower() not in HEADERS_TO_IGNORE:
119119
xhr.setRequestHeader(name, value)
120120

121-
xhr.send(to_js(request.body))
121+
body = request.body
122+
123+
if hasattr(body, 'read'):
124+
body = body.read()
125+
126+
xhr.send(to_js(body))
122127

123128
headers = dict(Parser().parsestr(xhr.getAllResponseHeaders()))
124129

0 commit comments

Comments
 (0)