We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7e8c8d2 commit 1e1c7a7Copy full SHA for 1e1c7a7
http/etag.ts
@@ -158,7 +158,11 @@ export async function eTag(
158
? calcFileInfo(entity, options)
159
: calcEntity(entity, options));
160
161
- return tag ? weak ? `W/"${tag}"` : `"${tag}"` : undefined;
+ if (!tag) {
162
+ return undefined;
163
+ }
164
+
165
+ return weak ? `W/"${tag}"` : `"${tag}"`;
166
}
167
168
const STAR_REGEXP = /^\s*\*\s*$/;
http/etag_test.ts
@@ -147,3 +147,17 @@ Deno.test({
147
148
},
149
});
150
151
+Deno.test({
152
+ name: "eTag() returns undefined when calcFileInfo returns undefined",
153
+ async fn() {
154
+ {
155
+ const result = await eTag({
156
+ mtime: null,
157
+ size: 1024,
+ });
+ assert(result === undefined);
+ },
+});
0 commit comments