mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 23:00:18 +00:00
document limits
This commit is contained in:
+7
-3
@@ -153,11 +153,12 @@ def relative_redirect_n_times(n):
|
||||
def stream_n_messages(n):
|
||||
"""Stream n JSON messages"""
|
||||
response = get_dict('url', 'args', 'headers', 'origin')
|
||||
n = min(n, 100)
|
||||
|
||||
def generate_stream():
|
||||
for i in range(n):
|
||||
response["id"] = i
|
||||
yield json.dumps(response) + "\n"
|
||||
response['id'] = i
|
||||
yield json.dumps(response) + '\n'
|
||||
|
||||
return Response(generate_stream(), headers={
|
||||
"Transfer-Encoding": "chunked",
|
||||
@@ -190,9 +191,10 @@ def view_status_code(codes):
|
||||
|
||||
@app.route('/response-headers')
|
||||
def response_headers():
|
||||
""" Returns a set of response headers from the query string """
|
||||
"""Returns a set of response headers from the query string """
|
||||
headers = CaseInsensitiveDict(request.args.items())
|
||||
response = jsonify(headers.items())
|
||||
|
||||
while True:
|
||||
content_len_shown = response.headers['Content-Length']
|
||||
response = jsonify(response.headers.items())
|
||||
@@ -276,11 +278,13 @@ def digest_auth(qop=None, user='user', passwd='passwd'):
|
||||
def delay_response(delay):
|
||||
"""Returns a delayed response"""
|
||||
delay = min(delay, 10)
|
||||
|
||||
time.sleep(delay)
|
||||
|
||||
return jsonify(get_dict(
|
||||
'url', 'args', 'form', 'data', 'origin', 'headers', 'files'))
|
||||
|
||||
|
||||
@app.route('/base64/<value>')
|
||||
def decode_base64(value):
|
||||
"""Decodes base64url-encoded string"""
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
<li><a href="/basic-auth/user/passwd"><code>/basic-auth/:user/:passwd</code></a> Challenges HTTPBasic Auth.</li>
|
||||
<li><a href="/hidden-basic-auth/user/passwd"><code>/hidden-basic-auth/:user/:passwd</code></a> 404'd BasicAuth.</li>
|
||||
<li><a href="/digest-auth/auth/user/passwd"><code>/digest-auth/:qop/:user/:passwd</code></a> Challenges HTTP Digest Auth.</li>
|
||||
<li><a href="/stream/100"><code>/stream/:n</code></a> Streams <em>n</em> lines.</li>
|
||||
<li><a href="/delay/3"><code>/delay/:n</code></a> Delays responding for <em>n</em> seconds.</li>
|
||||
<li><a href="/stream/20"><code>/stream/:n</code></a> Streams <em>n</em>–100 lines.</li>
|
||||
<li><a href="/delay/3"><code>/delay/:n</code></a> Delays responding for <em>n</em>–10 seconds.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user