mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 06:46:16 +00:00
Fix a ResourceWarning: unclosed file in core.py
This commit is contained in:
+2
-1
@@ -1725,7 +1725,8 @@ def image_svg():
|
|||||||
|
|
||||||
def resource(filename):
|
def resource(filename):
|
||||||
path = os.path.join(tmpl_dir, filename)
|
path = os.path.join(tmpl_dir, filename)
|
||||||
return open(path, "rb").read()
|
with open(path, "rb") as f:
|
||||||
|
return f.read()
|
||||||
|
|
||||||
|
|
||||||
@app.route("/xml")
|
@app.route("/xml")
|
||||||
|
|||||||
Reference in New Issue
Block a user