Catch exceptions when trying to read HTTP body in logs

Fixes https://sentry.io/organizations/coreos/issues/627586398/events/9ea9873f11e6456abc58f5de10951e44/?project=52148
This commit is contained in:
Joseph Schorr 2019-02-18 12:11:35 -05:00
parent 166fd671c8
commit 68300b2644

7
app.py
View file

@ -11,6 +11,7 @@ from flask_login import LoginManager
from flask_mail import Mail
from flask_principal import Principal
from jwkest.jwk import RSAKey
from werkzeug.exceptions import HTTPException
import features
@ -143,7 +144,11 @@ FILTERED_VALUES = [
@app.after_request
def _request_end(resp):
jsonbody = request.get_json(force=True, silent=True)
try:
jsonbody = request.get_json(force=True, silent=True)
except HTTPException:
jsonbody = None
values = request.values.to_dict()
if jsonbody and not isinstance(jsonbody, dict):