This repository was archived by the owner on Jul 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -141,11 +141,11 @@ export const serve = (options: ServerOptions = {}) => {
141
141
const deployId = getDeploymentId ( ) ;
142
142
let etag : string | null = null ;
143
143
if ( deployId ) {
144
- etag = `${ btoa ( pathname ) . replace ( / [ ^ a - z 0 - 9 ] / g, "" ) } -${ deployId } ` ;
144
+ etag = `W/ ${ btoa ( pathname ) . replace ( / [ ^ a - z 0 - 9 ] / g, "" ) } -${ deployId } ` ;
145
145
} else {
146
146
const { mtime, size } = stat ;
147
147
if ( mtime ) {
148
- etag = mtime . getTime ( ) . toString ( 16 ) + "-" + size . toString ( 16 ) ;
148
+ etag = `W/ ${ mtime . getTime ( ) . toString ( 16 ) } - ${ size . toString ( 16 ) } ` ;
149
149
headers . append ( "Last-Modified" , new Date ( mtime ) . toUTCString ( ) ) ;
150
150
}
151
151
}
Original file line number Diff line number Diff line change @@ -168,11 +168,11 @@ export default {
168
168
const deployId = getDeploymentId ( ) ;
169
169
let etag : string | null = null ;
170
170
if ( deployId ) {
171
- etag = `${ btoa ( "./index.html" ) . replace ( / [ ^ a - z 0 - 9 ] / g, "" ) } -${ deployId } ` ;
171
+ etag = `W/ ${ btoa ( "./index.html" ) . replace ( / [ ^ a - z 0 - 9 ] / g, "" ) } -${ deployId } ` ;
172
172
} else {
173
173
const { mtime, size } = await Deno . lstat ( "./index.html" ) ;
174
174
if ( mtime ) {
175
- etag = mtime . getTime ( ) . toString ( 16 ) + "-" + size . toString ( 16 ) ;
175
+ etag = `W/ ${ mtime . getTime ( ) . toString ( 16 ) } - ${ size . toString ( 16 ) } ` ;
176
176
headers . append ( "Last-Modified" , new Date ( mtime ) . toUTCString ( ) ) ;
177
177
}
178
178
}
Original file line number Diff line number Diff line change @@ -29,15 +29,15 @@ export default {
29
29
const deployId = getDeploymentId ( ) ;
30
30
let etag : string | null = null ;
31
31
if ( deployId ) {
32
- etag = `${ btoa ( pathname ) . replace ( / [ ^ a - z 0 - 9 ] / g, "" ) } -${ deployId } ` ;
32
+ etag = `W/ ${ btoa ( pathname ) . replace ( / [ ^ a - z 0 - 9 ] / g, "" ) } -${ deployId } ` ;
33
33
} else {
34
34
const stat = await Deno . lstat ( filePath ) ;
35
35
if ( ! stat . isFile ) {
36
36
return new Response ( "File Not Found" , { status : 404 } ) ;
37
37
}
38
38
const { mtime, size } = stat ;
39
39
if ( mtime ) {
40
- etag = mtime . getTime ( ) . toString ( 16 ) + "-" + size . toString ( 16 ) ;
40
+ etag = `W/ ${ mtime . getTime ( ) . toString ( 16 ) } - ${ size . toString ( 16 ) } ` ;
41
41
headers . append ( "Last-Modified" , new Date ( mtime ) . toUTCString ( ) ) ;
42
42
}
43
43
}
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ export default {
57
57
}
58
58
59
59
const etag = mtime
60
- ? `${ mtime . toString ( 16 ) } -${ sourceCode . length . toString ( 16 ) } -${ buildHash . slice ( 0 , 8 ) } `
60
+ ? `W/ ${ mtime . toString ( 16 ) } -${ sourceCode . length . toString ( 16 ) } -${ buildHash . slice ( 0 , 8 ) } `
61
61
: await util . computeHash ( "sha-1" , sourceCode + buildHash ) ;
62
62
if ( req . headers . get ( "If-None-Match" ) === etag ) {
63
63
return new Response ( null , { status : 304 } ) ;
You can’t perform that action at this time.
0 commit comments