mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 14:50:17 +00:00
Add xml endpoint
This commit is contained in:
committed by
Kevin McCarthy
parent
b2cb8678f3
commit
64d10cba0e
+7
-1
@@ -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()
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version='1.0' encoding='us-ascii'?>
|
||||
|
||||
<!-- A SAMPLE set of slides -->
|
||||
|
||||
<slideshow
|
||||
title="Sample Slide Show"
|
||||
date="Date of publication"
|
||||
author="Yours Truly"
|
||||
>
|
||||
|
||||
<!-- TITLE SLIDE -->
|
||||
<slide type="all">
|
||||
<title>Wake up to WonderWidgets!</title>
|
||||
</slide>
|
||||
|
||||
<!-- OVERVIEW -->
|
||||
<slide type="all">
|
||||
<title>Overview</title>
|
||||
<item>Why <em>WonderWidgets</em> are great</item>
|
||||
<item/>
|
||||
<item>Who <em>buys</em> WonderWidgets</item>
|
||||
</slide>
|
||||
|
||||
</slideshow>
|
||||
Reference in New Issue
Block a user