feat(api): serve well-known discovery with etag and 304 (#2349)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-02 17:24:11 +02:00
1 parent 5719dfe8a3
commit 4f48e04cad
4 files changed
+74

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
function stripWeakness(entityTag: string): string {
return entityTag.startsWith('W/') ? entityTag.slice(2) : entityTag;
}
export function entityTagMatches(ifNoneMatch: string, etag: string): boolean {
const target = stripWeakness(etag.trim());
return ifNoneMatch
.split(',')
.map((candidate) => candidate.trim())
.some((candidate) => candidate === '*' || stripWeakness(candidate) === target);
}