diff --git a/httpbin/core.py b/httpbin/core.py index 602378f..29760a7 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -45,7 +45,6 @@ tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates') app = Flask(__name__, template_folder=tmpl_dir) - # ----------- # Middlewares # ----------- @@ -535,5 +534,12 @@ def image(): return status_code(404) +@app.route("/xml") +def xml(): + response = make_response(render_template("sample.xml")) + response.headers["Content-Type"] = "application/xml" + return response + + if __name__ == '__main__': app.run() diff --git a/httpbin/templates/sample.xml b/httpbin/templates/sample.xml new file mode 100644 index 0000000..5ff0957 --- /dev/null +++ b/httpbin/templates/sample.xml @@ -0,0 +1,24 @@ + + + + + + + + + Wake up to WonderWidgets! + + + + + Overview + Why WonderWidgets are great + + Who buys WonderWidgets + + +