Skip to content

Commit

Permalink
Added test and docs for #267 which fixes that requests got incorrectl…
Browse files Browse the repository at this point in the history
…y marked as GET requests, if they resulted in a redirect
  • Loading branch information
heyman committed Mar 28, 2015
1 parent b6ca5c1 commit 47abba7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=====

Expand Down
10 changes: 10 additions & 0 deletions locust/test/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

2 changes: 1 addition & 1 deletion locust/test/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 47abba7

Please sign in to comment.