mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Add etag to /api/v1/annotations
This commit is contained in:
parent
71bc9eea28
commit
494c954cbb
1 changed files with 7 additions and 1 deletions
|
@ -4042,7 +4042,13 @@ get "/api/v1/annotations/:id" do |env|
|
|||
annotations = response.body
|
||||
end
|
||||
|
||||
annotations
|
||||
etag = sha256(annotations)[0, 16]
|
||||
if env.request.headers["If-None-Match"]?.try &.== etag
|
||||
env.response.status_code = 304
|
||||
else
|
||||
env.response.headers["ETag"] = etag
|
||||
annotations
|
||||
end
|
||||
end
|
||||
|
||||
get "/api/v1/videos/:id" do |env|
|
||||
|
|
Loading…
Reference in a new issue