Hacker News new | ask | show | jobs
by systemvoltage 1869 days 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.

2 comments

I 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.
Yes I did. Thanks!
"common HTTP methods" meaning GET, POST, PUT, PATCH, DELETE not "/login", etc (those would be routes)