htmx-router 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/response.js +2 -1
- package/package.json +1 -1
package/dist/response.js
CHANGED
|
@@ -97,6 +97,7 @@ export function refresh(init) {
|
|
|
97
97
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/ETag | ETag - MDN Web Docs }
|
|
98
98
|
*/
|
|
99
99
|
export function AssertETagStale(request, headers, etag, options) {
|
|
100
|
+
headers.delete("Cache-Control"); // clear any defaults
|
|
100
101
|
if (options) {
|
|
101
102
|
// default to private, because it's the slightly less worse of the two potential foot guns
|
|
102
103
|
if (options.public)
|
|
@@ -107,7 +108,7 @@ export function AssertETagStale(request, headers, etag, options) {
|
|
|
107
108
|
headers.append("Cache-Control", `max-age=${options.revalidate}`);
|
|
108
109
|
}
|
|
109
110
|
headers.append("Cache-Control", "must-revalidate");
|
|
110
|
-
headers.set("ETag", `"${etag}"`);
|
|
111
|
+
headers.set("ETag", `"${encodeURIComponent(etag.trim())}"`);
|
|
111
112
|
const client = request.headers.get("if-none-match");
|
|
112
113
|
if (client !== etag)
|
|
113
114
|
return;
|