mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 14:50:17 +00:00
document limits
This commit is contained in:
@@ -24,8 +24,8 @@ Freely hosted in [HTTP](http://httpbin.org) &
|
||||
- [`/basic-auth/:user/:passwd`](http://httpbin.org/basic-auth/user/passwd) Challenges HTTPBasic Auth.
|
||||
- [`/hidden-basic-auth/:user/:passwd`](http://httpbin.org/hidden-basic-auth/user/passwd) 404'd BasicAuth.
|
||||
- [`/digest-auth/:qop/:user/:passwd`](http://httpbin.org/digest-auth/auth/user/passwd) Challenges HTTP Digest Auth.
|
||||
- [`/stream/:n`](http://httpbin.org/stream/100) Streams *n* lines.
|
||||
- [`/delay/:n`](/delay/3) Delays responding for *n* seconds.
|
||||
- [`/stream/:n`](http://httpbin.org/stream/20) Streams *n*–100 lines.
|
||||
- [`/delay/:n`](/delay/3) Delays responding for *n*–10 seconds.
|
||||
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
+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