I am debugging a microcontroller I\'ve built which is writing raw HTTP requests line by line. I am using Flask for my backend and I would like to see the entire request as it a
Why not?
from flask import Flask, request
app = Flask(__name__)
@app.before_request
def log_request():
app.logger.debug("Request Headers %s", request.headers)
return None
# The remaining application code.
I've used the headers but you can use the same aproach to print any request attribute. The docs are here: http://flask.pocoo.org/docs/0.12/api/#flask.Request.
Also you need to setup FLASK_DEBUG=1 to Flask.logger.debug to work, what is nice since you can disable it in production.
Regards,