-
-
Notifications
You must be signed in to change notification settings - Fork 16.6k
Closed
Closed
Copy link
Milestone
Description
Expected Behavior
When self.form is indexed with a key that isn't present, BadRequestKeyError is raised. Under 1.0.2 and below, the .args property of this exception contained the actual missing key -- great for lightweight error presentation.
Minimal demonstration:
from flask import Flask, jsonify, request
from werkzeug.exceptions import BadRequestKeyError
app = Flask('test')
@app.errorhandler(BadRequestKeyError)
def bad_key(e):
return jsonify({'missing key(s)': e.args})
@app.route('/')
def root():
return request.form['foo']
app.run()Under 1.0.2 and below we see the following behavior:
% curl localhost:5000
{"missing key(s)":["foo"]}
Under 1.0.3:
% curl localhost:5000
{"missing key(s)":[]}
This occurs independent of $FLASK_DEBUG
Actual Behavior
There appears to be no way to get at the missing key from an error handler.
Environment
- Python version: 3.6.6
- Flask version: 1.0.3
- Werkzeug version: 0.15.4
Metadata
Metadata
Assignees
Labels
No labels