Skip to content
Myr

Changed error message to include actual exception contents

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Keyan Pishdadian · committed by Keyan Pishdadian · parent 290c371 · Browse files · 2 files+3 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+3 added−3 removed

  • tests:+2 added−2 removed
  • other:+1 added−1 removed

2 files+3 added−3 removed

modified:flask/wrappers.py+1 added-1 removed
175 unmodified lines
176 """177 ctx = _request_ctx_stack.top178 if ctx is not None:179 if ctx.app.config.get('DEBUG', False):180 raise BadRequest('No JSON object could be decoded')180 raise BadRequest('Failed to decode JSON object: {}'.format(e))181 raise BadRequest()182183 def _load_form_data(self):184 RequestBase._load_form_data(self)
20 unmodified lines
modified:tests/test_helpers.py+2 added-2 removed
57 unmodified lines
58 return None59 c = app.test_client()60 rv = c.post('/json', data=None, content_type='application/json')61 assert rv.status_code == 40062 assert b'No JSON object could be decoded' in rv.data62 assert b'Failed to decode JSON object' in rv.data6364 def test_post_empty_json_wont_add_exception_to_response_if_no_debug(self):65 app = flask.Flask(__name__)66 app.config['DEBUG'] = False
3 unmodified lines
70 return None71 c = app.test_client()72 rv = c.post('/json', data=None, content_type='application/json')73 assert rv.status_code == 40074 assert b'No JSON object could be decoded' not in rv.data74 assert b'Failed to decode JSON object' not in rv.data7576 def test_json_bad_requests(self):77 app = flask.Flask(__name__)78 @app.route('/json', methods=['POST'])
602 unmodified lines