3 ms·
> Add route decorators for common HTTP methods. For example, @app.post("/login") is a shortcut for @app.route("/login", methods=["POST"]). #3907 Why? By defaul
by systemvoltage 6y ago
> Add route decorators for common HTTP methods. For example, @app.post("/login") is a shortcut for @app.route("/login", methods=["POST"]). #3907
Why? By default, it’s GET if you don’t specify a method. But now with this change, for special routes such as “/login” it’s POST. IMO these kinds of things make for “gotcha” moments. Just keep defaults simple without special exceptions.
- Hasnep 6y agoI think you've misread the change, it's nothing to do with login being a special case, it's about moving the HTTP method from the methods argument to the function name.
- systemvoltage 6y agoYes I did. Thanks!
- zild3d 6y ago"common HTTP methods" meaning GET, POST, PUT, PATCH, DELETE not "/login", etc (those would be routes)