Display search results in api mode and regular
This commit is contained in:
parent
1f06d1a1d8
commit
98325818b2
6 changed files with 155 additions and 41 deletions
|
@ -32,7 +32,9 @@ 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 re.match(
|
||||
r".*\.json/?$", request.path
|
||||
)
|
||||
|
||||
|
||||
def is_bookwyrm_request(request):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue