def before_request(self):
        ctx = _request_ctx_stack.top
        dest = self.app.view_functions.get(request.endpoint)
        ctx.request_json = dest in self._json_views
        if ctx.request_json:
            if not request.is_xhr:
                ctx.forbidden = True
                abort(403)
            else:
                ctx.forbidden = False
dataset/ETHPy150Open lanius/flask-mitten/flaskext/mitten.py/Mitten.before_request/original