Skip to content

Commit

Permalink
Merge pull request #6 from akarasik/bugfix/header_parsing
Browse files Browse the repository at this point in the history
BUGFIX: Update the duration extraction from the Server-Timing header
  • Loading branch information
12932 authored Jun 29, 2024
2 parents 25c88ac + 7c93584 commit 991f816
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cf_speedtest/speedtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ def get_server_timing(server_timing: str) -> float:
split = server_timing.split(';')
for part in split:
if 'dur=' in part:
return float(part.split('=')[1]) / 1000
try:
return float(part.split('=')[1]) / 1000
except:
return float(part.split(",")[0].split("=")[1]) / 1000

# given an amount of bytes, upload it and return the elapsed seconds taken

Expand Down

0 comments on commit 991f816

Please sign in to comment.