File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,18 @@ const handler =
15
15
cacheRoot : Deno . cwd ( ) ,
16
16
}
17
17
)
18
+
19
+ const originHeaders = await fetch ( target ) . then ( x => x . headers )
20
+
21
+ const cacheHeaders = Object . fromEntries (
22
+ [
23
+ "cache-control" ,
24
+ "age" ,
25
+ "expires" ,
26
+ "etag" ,
27
+ ] . map ( header => [ header , originHeaders . get ( header ) ! ] )
28
+ )
29
+
18
30
return new Response (
19
31
result . get ( target . href ) || "" ,
20
32
{
@@ -23,6 +35,7 @@ const handler =
23
35
"content-type" : "application/javascript" ,
24
36
"access-control-allow-origin" : "*" ,
25
37
"x-typescript-types" : target . href ,
38
+ ...cacheHeaders ,
26
39
} ,
27
40
}
28
41
)
Original file line number Diff line number Diff line change 6
6
< body >
7
7
Hello, World!
8
8
< script type ="module ">
9
- import { $ } from "http://tsm.deno.dev /https://deno.land/x/[email protected] /mod.ts"
9
+ import { $ } from "http://localhost:8081 /https://deno.land/x/[email protected] /mod.ts"
10
10
$ ( [ 1 , 2 , 3 , 4 , 5 ] )
11
11
. filter ( x => x % 2 === 0 )
12
12
. map ( x => x * 2 )
You can’t perform that action at this time.
0 commit comments