Skip to content

Commit 3ce80e7

Browse files
committed
fix: normalize python browser request string bodies
Encode string request bodies before building raw /curl/raw request options so the browser routing helpers satisfy CI type checks while preserving the public request API. Made-with: Cursor
1 parent 9690923 commit 3ce80e7

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/kernel/lib/browser_routing/raw_http.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,11 @@ def _normalize_timeout(timeout: float | Timeout | None | NotGiven) -> float | Ti
138138
return None if isinstance(timeout, NotGiven) else timeout
139139

140140

141-
def _normalize_binary_content(content: BrowserRawContent | None) -> bytes | str | IO[bytes] | Iterable[bytes] | None:
141+
def _normalize_binary_content(content: BrowserRawContent | None) -> bytes | IO[bytes] | Iterable[bytes] | None:
142142
if content is None:
143143
return None
144+
if isinstance(content, str):
145+
return content.encode()
144146
if isinstance(content, bytearray):
145147
return bytes(content)
146148
if isinstance(content, memoryview):

0 commit comments

Comments
 (0)