Merge branch 'master' of https://github.com/mansilladev/httpbin into drip-limit

Conflicts:
    README.rst
This commit is contained in:
Ian Cordasco
2016-08-10 19:43:46 -05:00
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -41,9 +41,9 @@ Endpoint Description
`/basic-auth/:user/:passwd`_ Challenges HTTPBasic Auth.
`/hidden-basic-auth/:user/:passwd`_ 404'd BasicAuth.
`/digest-auth/:qop/:user/:passwd`_ Challenges HTTP Digest Auth.
`/stream/:n`_ Streams *n* - 100 lines.
`/delay/:n`_ Delays responding for *n* - 10 seconds.
`/drip`_ Drips data over a duration after an optional initial delay, then (optionally) returns with the given status code.
`/stream/:n`_ Streams *n* 100 lines.
`/delay/:n`_ Delays responding for *n* 10 seconds.
`/drip`_ Drips up to 10MB data over a duration after an optional initial delay, then (optionally) returns with the given status code.
`/range/:n`_ Streams *n* bytes, and allows specifying a *Range* header to select a subset of the data. Accepts a *chunk\_size* and request *duration* parameter.
`/html`_ Renders an HTML Page.
`/robots.txt`_ Returns some robots.txt rules.
+1 -1
View File
@@ -460,7 +460,7 @@ def drip():
"""Drips data over a duration after an optional initial delay."""
args = CaseInsensitiveDict(request.args.items())
duration = float(args.get('duration', 2))
numbytes = int(args.get('numbytes', 10))
numbytes = min(int(args.get('numbytes', 10)),(10 * 1024 * 1024)) # set 10MB limit
code = int(args.get('code', 200))
pause = duration / numbytes