From e3f2dd8f080115d626437bbee3631f7cf5560ca5 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Fri, 27 May 2011 15:59:11 +0200 Subject: [PATCH] Added a test for content length behavior --- tests/flask_tests.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/flask_tests.py b/tests/flask_tests.py index 6b6daaa4..b723f217 100644 --- a/tests/flask_tests.py +++ b/tests/flask_tests.py @@ -782,6 +782,22 @@ class BasicFunctionalityTestCase(unittest.TestCase): t.start() t.join() + def test_max_content_length(self): + app = flask.Flask(__name__) + app.debug = True + app.config['MAX_CONTENT_LENGTH'] = 64 + @app.route('/accept', methods=['POST']) + def accept_file(): + flask.request.form['myfile'] + assert False + @app.errorhandler(413) + def catcher(error): + return '42' + + c = app.test_client() + rv = c.post('/accept', data={'myfile': 'foo' * 100}) + assert rv.data == '42' + class JSONTestCase(unittest.TestCase):