<p dir="auto">It seems  "Request" object has no attribute "is_xhr" ，Getting warnings here...  How do we fix this?<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/70581416/104300976-16751700-5502-11eb-9b61-51f3baa8d083.png"><img src="https://user-images.githubusercontent.com/70581416/104300976-16751700-5502-11eb-9b61-51f3baa8d083.png" alt="6f2ab2c357e4a36213b6ad42b7d9669" style="max-width: 100%;"></a></p>
<p dir="auto">This has been raised several times <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="561678002" data-permission-text="Title is private" data-url="https://github.com/pallets/flask/issues/3490" data-hovercard-type="issue" data-hovercard-url="/pallets/flask/issues/3490/hovercard" href="https://github.com/pallets/flask/issues/3490">#3490</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="561585108" data-permission-text="Title is private" data-url="https://github.com/pallets/flask/issues/3486" data-hovercard-type="issue" data-hovercard-url="/pallets/flask/issues/3486/hovercard" href="https://github.com/pallets/flask/issues/3486">#3486</a> etc.</p>
<p dir="auto">These have been closed due to no stacktrace or the issue being in a third party project.<br>
Here are some reproducible examples just using Flask.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt; python --version
Python 3.8.0
&gt; pip install flask==0.12.4
Successfully installed Jinja2-2.11.1 MarkupSafe-1.1.1 Werkzeug-1.0.0 click-7.0 flask-0.12.4 itsdangerous-1.1.0"><pre class="notranslate"><code class="notranslate">&gt; python --version
Python 3.8.0
&gt; pip install flask==0.12.4
Successfully installed Jinja2-2.11.1 MarkupSafe-1.1.1 Werkzeug-1.0.0 click-7.0 flask-0.12.4 itsdangerous-1.1.0
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from flask import Flask, request
app = Flask(__name__)

@app.route('/')
def hello_world():
    return &quot;Is xhr&quot; if request.is_xhr else &quot;Isn't xhr&quot;"><pre class="notranslate"><code class="notranslate">from flask import Flask, request
app = Flask(__name__)

@app.route('/')
def hello_world():
    return "Is xhr" if request.is_xhr else "Isn't xhr"
</code></pre></div>
<p dir="auto">Using the documented property <a href="https://flask.palletsprojects.com/en/0.12.x/api/#flask.Request.is_xhr" rel="nofollow">is_xhr</a> gives</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  File &quot;/home/mitchell/.virtualenvs/flask/lib/python3.8/site-packages/werkzeug/local.py&quot;, line 347, in __getattr__
    return getattr(self._get_current_object(), name)
AttributeError: 'Request' object has no attribute 'is_xhr'"><pre class="notranslate"><code class="notranslate">  File "/home/mitchell/.virtualenvs/flask/lib/python3.8/site-packages/werkzeug/local.py", line 347, in __getattr__
    return getattr(self._get_current_object(), name)
AttributeError: 'Request' object has no attribute 'is_xhr'
</code></pre></div>
<p dir="auto">Also in <code class="notranslate">jsonify</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from flask import Flask, jsonify
app = Flask(__name__)

@app.route('/')
def hello_world():
    return jsonify({
        &quot;hello&quot;: &quot;world&quot;,
    })"><pre class="notranslate"><code class="notranslate">from flask import Flask, jsonify
app = Flask(__name__)

@app.route('/')
def hello_world():
    return jsonify({
        "hello": "world",
    })
</code></pre></div>
<p dir="auto">gives</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  File &quot;/home/mitchell/.virtualenvs/flask/lib/python3.8/site-packages/flask/json.py&quot;, line 298, in jsonify
    if current_app.config['JSONIFY_PRETTYPRINT_REGULAR'] and not request.is_xhr:
  File &quot;/home/mitchell/.virtualenvs/flask/lib/python3.8/site-packages/werkzeug/local.py&quot;, line 347, in __getattr__
    return getattr(self._get_current_object(), name)
AttributeError: 'Request' object has no attribute 'is_xhr'"><pre class="notranslate"><code class="notranslate">  File "/home/mitchell/.virtualenvs/flask/lib/python3.8/site-packages/flask/json.py", line 298, in jsonify
    if current_app.config['JSONIFY_PRETTYPRINT_REGULAR'] and not request.is_xhr:
  File "/home/mitchell/.virtualenvs/flask/lib/python3.8/site-packages/werkzeug/local.py", line 347, in __getattr__
    return getattr(self._get_current_object(), name)
AttributeError: 'Request' object has no attribute 'is_xhr'
</code></pre></div>
<p dir="auto">Hopefully these purely-flask reproducible examples will help this get sorted out.</p>