diff --git a/httpbin/core.py b/httpbin/core.py index f793d5d..8b19149 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -272,6 +272,15 @@ def digest_auth(qop=None, user='user', passwd='passwd'): return jsonify(authenticated=True, user=user) +@app.route('/delay/') +def delay_response(delay): + """Returns a delayed response""" + delay = min(delay, 30) + time.sleep(delay) + + return jsonify(get_dict( + 'url', 'args', 'form', 'data', 'origin', 'headers', 'files')) + @app.route('/base64/') def decode_base64(value): """Decodes base64url-encoded string""" diff --git a/httpbin/templates/httpbin.1.html b/httpbin/templates/httpbin.1.html index d932a8c..6a56e3a 100644 --- a/httpbin/templates/httpbin.1.html +++ b/httpbin/templates/httpbin.1.html @@ -25,6 +25,7 @@
  • /hidden-basic-auth/:user/:passwd 404'd BasicAuth.
  • /digest-auth/:qop/:user/:passwd Challenges HTTP Digest Auth.
  • /stream/:n Streams n lines.
  • +
  • /delay/:n Delays responding for n seconds.