Flask

HTTP method mismatch returns 405 instead of 200

warning
configurationUpdated Mar 19, 2026(via Exa)
Technologies:
How to detect:

Flask routes default to GET only. Sending POST to GET-only route returns 405 Method Not Allowed. Routes need explicit methods=['GET', 'POST'] or method-specific decorators.

Recommended action:

Add methods parameter to @app.route() decorator: @app.route('/api/users', methods=['GET', 'POST']). Or use Flask 2.0+ method decorators: @app.get() and @app.post(). Verify with 'flask routes' which methods are registered.