Branch Logic by request.method
Serve a form on GET and process it on POST.
One Route, Two Jobs
A route that accepts both GET and POST often needs to behave differently for each. You handle that by checking which verb arrived.
The request Object
Flask gives you a global request object that describes the incoming call. Import it once and use it inside any view.
from flask import requestAll lessons in this course
- Declare Allowed Methods on a Route
- Branch Logic by request.method
- Read POST Data from the Body
- 405 Method Not Allowed Explained