mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 06:46:16 +00:00
Documented query parameters for drip
This commit is contained in:
+26
-1
@@ -1102,6 +1102,31 @@ def drip():
|
|||||||
---
|
---
|
||||||
tags:
|
tags:
|
||||||
- Dynamic data
|
- Dynamic data
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: duration
|
||||||
|
type: number
|
||||||
|
description: The amount of time (in seconds) over which to drip each byte
|
||||||
|
default: 2
|
||||||
|
required: false
|
||||||
|
- in: query
|
||||||
|
name: numbytes
|
||||||
|
type: integer
|
||||||
|
description: The number of bytes to respond with
|
||||||
|
default: 10
|
||||||
|
required: false
|
||||||
|
- in: query
|
||||||
|
name: code
|
||||||
|
type: integer
|
||||||
|
description: The response code that will be returned
|
||||||
|
default: 200
|
||||||
|
required: false
|
||||||
|
- in: query
|
||||||
|
name: delay
|
||||||
|
type: number
|
||||||
|
description: The amount of time (in seconds) to delay before responding
|
||||||
|
default: 2
|
||||||
|
required: false
|
||||||
produces:
|
produces:
|
||||||
- application/octet-stream
|
- application/octet-stream
|
||||||
responses:
|
responses:
|
||||||
@@ -1124,7 +1149,7 @@ def drip():
|
|||||||
pause = duration / numbytes
|
pause = duration / numbytes
|
||||||
def generate_bytes():
|
def generate_bytes():
|
||||||
for i in xrange(numbytes):
|
for i in xrange(numbytes):
|
||||||
yield u"*".encode('utf-8')
|
yield b"*"
|
||||||
time.sleep(pause)
|
time.sleep(pause)
|
||||||
|
|
||||||
response = Response(generate_bytes(), headers={
|
response = Response(generate_bytes(), headers={
|
||||||
|
|||||||
Reference in New Issue
Block a user