diff --git a/httpbin/core.py b/httpbin/core.py index 9970401..0d9564e 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -148,6 +148,13 @@ 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): + """ Redirect to the given URL. """ + response = app.make_response('') + response.status_code = 302 + response.headers['Location'] = url + return response @app.route('/stream/') def stream_n_messages(n): diff --git a/httpbin/templates/httpbin.1.html b/httpbin/templates/httpbin.1.html index 857948f..5c22c5f 100644 --- a/httpbin/templates/httpbin.1.html +++ b/httpbin/templates/httpbin.1.html @@ -19,6 +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.
  • /cookies Returns cookie data.
  • /cookies/set/:name/:value Sets a simple cookie.
  • /basic-auth/:user/:passwd Challenges HTTPBasic Auth.