Files
codeql/python/ql/test/library-tests/frameworks/flask/template_test.py
2026-06-02 13:49:24 +02:00

17 lines
582 B
Python

from flask import Flask, Response, stream_with_context, render_template_string, stream_template_string
app = Flask(__name__) # $ instance
@app.route("/a") # $ routeSetup="/a"
def a(): # $ requestHandler
r = render_template_string("abc") # $ templateConstruction="abc"
return r # $ HttpResponse
@app.route("/b") # $ routeSetup="/b"
def b(): # $ requestHandler
s = stream_template_string("abc") # $ templateConstruction="abc"
r = Response(stream_with_context(s)) # $ HttpResponse
return r # $ HttpResponse
if __name__ == "__main__":
app.run(debug=True)