mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat(rpc): support the If-None-Match request header
If the If-None-Match header is supplied with a previously obtained ETag from the same query, a 304 Not Modified is returned with no content. This allows clients to completely leverage the ETag header. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
2cc44e8f28
commit
61f3cb938c
2 changed files with 15 additions and 2 deletions
|
@ -113,6 +113,11 @@ async def rpc(request: Request,
|
|||
"ETag": f'"{etag}"'
|
||||
}
|
||||
|
||||
if_none_match = request.headers.get("If-None-Match", str())
|
||||
if if_none_match and if_none_match.strip("\t\n\r\" ") == etag:
|
||||
return Response(headers=headers,
|
||||
status_code=int(HTTPStatus.NOT_MODIFIED))
|
||||
|
||||
if callback:
|
||||
content = f"/**/{callback}({content.decode()})"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue