1 | initial version |
This is because the Response object returned by the kerner.response function is not automatically sent to the client as a response. Instead, it is returned to the controller, which can then manipulate it further or use it in some way before sending it as a response.
In order to send the Response object as a response to the client, the controller needs to use the return statement to return the Response object. For example:
from flask import Flask, Response
app = Flask(__name__)
@app.route('/')
def hello_world():
response = Response("Hello, World!")
return response
if __name__ == '__main__':
app.run()
In this example, the hello_world function returns the Response object created by the kerner.response function. This Response object is then sent to the client as the response to the HTTP request.