diff --git a/flask/wrappers.py b/flask/wrappers.py index c3b16bc6..de5b21a1 100644 --- a/flask/wrappers.py +++ b/flask/wrappers.py @@ -13,7 +13,7 @@ from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase from werkzeug.exceptions import BadRequest from . import json -from .globals import _request_ctx_stack, current_app +from .globals import _request_ctx_stack _missing = object() @@ -175,9 +175,8 @@ class Request(RequestBase): .. versionadded:: 0.8 """ ctx = _request_ctx_stack.top - if ctx is not None: - if ctx.app.config.get('DEBUG', False): - raise BadRequest('Failed to decode JSON object: {0}'.format(e)) + if ctx is not None and ctx.app.config.get('DEBUG', False): + raise BadRequest('Failed to decode JSON object: {0}'.format(e)) raise BadRequest() def _load_form_data(self):