diff --git a/docs/changelog.rst b/docs/changelog.rst index f91a47e711..fbd0d7be7e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2,6 +2,13 @@ Changelog ########## +Dev +=== + +* Fixed bug where POST requests (and other methods as well) got incorrectly reported as + GET requests, if the request resulted in a redirect. + + 0.7.2 ===== diff --git a/locust/test/test_client.py b/locust/test/test_client.py index 481ad020f7..6bbbc7a04b 100644 --- a/locust/test/test_client.py +++ b/locust/test/test_client.py @@ -58,3 +58,13 @@ def test_slow_redirect(self): self.assertEqual(1, stats.num_requests) self.assertGreater(stats.avg_response_time, 500) + def test_post_redirect(self): + s = HttpSession("http://127.0.0.1:%i" % self.port) + url = "/redirect" + r = s.post(url) + self.assertEqual(200, r.status_code) + post_stats = global_stats.get(url, method="POST") + get_stats = global_stats.get(url, method="GET") + self.assertEqual(1, post_stats.num_requests) + self.assertEqual(0, get_stats.num_requests) + diff --git a/locust/test/testcases.py b/locust/test/testcases.py index 8e14811273..274c42cb4d 100644 --- a/locust/test/testcases.py +++ b/locust/test/testcases.py @@ -69,7 +69,7 @@ def manipulate(): def failed_request(): return "This response failed", 500 -@app.route("/redirect") +@app.route("/redirect", methods=["GET", "POST"]) def do_redirect(): delay = request.args.get("delay") if delay: