Skip to content

Commit 73d59ee

Browse files
committed
Fix issue when the history is empty.
Indeed, in some rare cases, the history may be empty. This patch fixes the issue by checking if the history is filled with data. Contributors: * @mitchellkrogza
1 parent eb821d3 commit 73d59ee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

PyFunceble/query/http_status_code.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,11 @@ def get_status_code(self) -> int:
357357
req.url
358358
).get_converted()
359359

360-
if not self.allow_redirects and first_origin != final_origin:
360+
if (
361+
not self.allow_redirects
362+
and first_origin != final_origin
363+
and req.history
364+
):
361365
return req.history[0].status_code
362366

363367
return req.status_code

0 commit comments

Comments
 (0)