Skip to content

Commit

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

Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 authored and jman-sketch committed Oct 17, 2024
1 parent f1b489e commit ec70007
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 ec70007

Please sign in to comment.