From 045f0f8843f24b4f0a8aa14c879c424d934bf9f0 Mon Sep 17 00:00:00 2001 From: Matt Hickford Date: Thu, 29 May 2014 23:11:25 +0100 Subject: [PATCH] Add endpoint /forms/post with simple HTML form that submits to /post --- httpbin/core.py | 7 +++++++ httpbin/templates/forms-post.html | 29 +++++++++++++++++++++++++++++ httpbin/templates/httpbin.1.html | 1 + 3 files changed, 37 insertions(+) create mode 100755 httpbin/templates/forms-post.html diff --git a/httpbin/core.py b/httpbin/core.py index 3232627..49837dd 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -291,6 +291,13 @@ def view_cookies(hide_env=True): return jsonify(cookies=cookies) +@app.route('/forms/post') +def view_forms_post(): + """Simple HTML form.""" + + return render_template('forms-post.html') + + @app.route('/cookies/set//') def set_cookie(name, value): """Sets a cookie and redirects to cookie list.""" diff --git a/httpbin/templates/forms-post.html b/httpbin/templates/forms-post.html new file mode 100755 index 0000000..e79dffd --- /dev/null +++ b/httpbin/templates/forms-post.html @@ -0,0 +1,29 @@ + + + + + + +
+

+

+

+
+ Pizza Size +

+

+

+
+
+ Pizza Toppings +

+

+

+

+
+

+

+

+
+ + diff --git a/httpbin/templates/httpbin.1.html b/httpbin/templates/httpbin.1.html index ff21912..005a3d3 100644 --- a/httpbin/templates/httpbin.1.html +++ b/httpbin/templates/httpbin.1.html @@ -36,6 +36,7 @@
  • /robots.txt Returns some robots.txt rules.
  • /deny Denied by robots.txt file.
  • /cache 200 unless If-Modified-Since was sent, then 304.
  • +
  • /forms/post HTML form that submits to /post.