Skip to content

Commit

Permalink
Escape failure messages
Browse files Browse the repository at this point in the history
  • Loading branch information
heyman committed Mar 10, 2020
1 parent 216f771 commit 3f9e0ad
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions locust/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,14 @@ def request_stats():
"ninetieth_response_time": s.get_response_time_percentile(0.9),
"avg_content_length": s.avg_content_length,
})

errors = [e.to_dict() for e in runner.errors.values()]


errors = []
for e in runner.errors.values():
err_dict = e.to_dict()
err_dict["name"] = escape(err_dict["name"])
err_dict["error"] = escape(err_dict["error"])
errors.append(err_dict)

# Truncate the total number of stats and errors displayed since a large number of rows will cause the app
# to render extremely slowly. Aggregate stats should be preserved.
report = {"stats": stats[:500], "errors": errors[:500]}
Expand Down

0 comments on commit 3f9e0ad

Please sign in to comment.