From 295dc90db6f52c8581d8a656ec3928a8f184b1a2 Mon Sep 17 00:00:00 2001 From: Chris Dary Date: Tue, 28 Feb 2012 10:43:08 -0500 Subject: [PATCH] Redirect-to now uses a query param instead. --- httpbin/core.py | 6 ++++-- httpbin/templates/httpbin.1.html | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/httpbin/core.py b/httpbin/core.py index 032083a..b745267 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -148,9 +148,11 @@ def relative_redirect_n_times(n): response.headers['Location'] = '/relative-redirect/{0}'.format(n - 1) return response -@app.route('/redirect-to/') -def redirect_to(url): + +@app.route('/redirect-to') +def redirect_to(): """ Redirect to the given URL. """ + url = request.args.get('url', '/') response = app.make_response('') response.status_code = 302 response.headers['Location'] = url diff --git a/httpbin/templates/httpbin.1.html b/httpbin/templates/httpbin.1.html index 5c22c5f..8c13f53 100644 --- a/httpbin/templates/httpbin.1.html +++ b/httpbin/templates/httpbin.1.html @@ -19,7 +19,7 @@
  • /response-headers?key=val Returns given response headers.
  • /redirect/:n 302 Redirects n times.
  • /relative-redirect/:n 302 Relative redirects n times.
  • -
  • /redirect-to/:url 302 Redirects to the given URL.
  • +
  • /redirect-to?url=some-url 302 Redirects to the given URL.
  • /cookies Returns cookie data.
  • /cookies/set/:name/:value Sets a simple cookie.
  • /basic-auth/:user/:passwd Challenges HTTPBasic Auth.