You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some frameworks use a readonly `Response` object, so you need to use an existing `headers` object. In this case you can use the `copyTo` method to copy the headers to the response:
111
+
112
+
```astro
113
+
---
114
+
import { CacheHeaders, ONE_HOUR } from "cdn-cache-control";
115
+
116
+
new CacheHeaders().swr(ONE_HOUR).copyTo(Astro.response.headers);
117
+
---
118
+
119
+
```
120
+
110
121
## API
111
122
112
123
<!-- TSDOC_START -->
@@ -168,6 +179,7 @@ Number of seconds in one year
168
179
-[immutable](#gear-immutable)
169
180
-[ttl](#gear-ttl)
170
181
-[toObject](#gear-toobject)
182
+
-[copyTo](#gear-copyto)
171
183
-[getCdnCacheControl](#gear-getcdncachecontrol)
172
184
-[setCdnCacheControl](#gear-setcdncachecontrol)
173
185
-[getCacheControl](#gear-getcachecontrol)
@@ -233,6 +245,14 @@ Returns the headers as a plain object.
233
245
| ---------- | ------------------------------ |
234
246
|`toObject`|`() => Record<string, string>`|
235
247
248
+
#### :gear: copyTo
249
+
250
+
Copy the headers from this instance to another Headers instance.
0 commit comments