Avoid error when request Accept header is not set
This commit is contained in:
parent
18c552d215
commit
662ddf44b9
2 changed files with 6 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue