Permalink
Browse files

Merge random status functionality into /status

  • Loading branch information...
1 parent 7646e33 commit 92c35813e0c5031609b896822c9f1f62de03d89d @johtso johtso committed Jan 23, 2012
Showing with 6 additions and 9 deletions.
  1. +6 −9 httpbin/core.py
View
@@ -165,16 +165,13 @@ def generate_stream():
})
-@app.route('/status/<int:code>')
-def view_status_code(code):
- """Returns given status code."""
+@app.route('/status/<codes>')
+def view_status_code(codes):
+ """Return status code or random status code if more than one are given"""
- return status_code(code)
-
-
-@app.route('/random-status/<codes>')
-def view_random_status_code(codes):
- """Return random status code from given status codes."""
+ if not ',' in codes:
+ code = int(codes)
+ return status_code(code)
choices = []
for choice in codes.split(','):

0 comments on commit 92c3581

Please sign in to comment.