Skip to content

Commit

Permalink
[py] Remote connection throws resp status code when data is empty (#1…
Browse files Browse the repository at this point in the history
…4601)

Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 authored Oct 15, 2024
1 parent c6e78d8 commit 4c2491f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion py/selenium/webdriver/remote/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,9 @@ def _request(self, method, url, body=None):
if 300 <= statuscode < 304:
return self._request("GET", response.headers.get("location", None))
if 399 < statuscode <= 500:
return {"status": statuscode, "value": data}
if statuscode == 401:
return {"status": statuscode, "value": "Authorization Required"}
return {"status": statuscode, "value": str(statuscode) if not data else data.strip()}
content_type = []
if response.headers.get("Content-Type", None):
content_type = response.headers.get("Content-Type", None).split(";")
Expand Down

0 comments on commit 4c2491f

Please sign in to comment.