Avoid error when request Accept header is not set

This commit is contained in:
Mouse Reeve
2021-03-29 14:05:58 -07:00
parent 18c552d215
commit 662ddf44b9
2 changed files with 6 additions and 1 deletions

View File

@ -21,7 +21,7 @@ def get_user_from_username(viewer, username):
def is_api_request(request):
""" check whether a request is asking for html or data """
return "json" in request.headers.get("Accept") or request.path[-5:] == ".json"
return "json" in request.headers.get("Accept", "") or request.path[-5:] == ".json"
def is_bookwyrm_request(request):