( Astro )
| 21 | ]) |
| 22 | |
| 23 | function getMaxAgeForUrl ( Astro ) { |
| 24 | const requestUrl = new URL( Astro.request.url ) |
| 25 | const urlPath = trimTrailingSlash( requestUrl.pathname ) |
| 26 | |
| 27 | // Top level list pages |
| 28 | if ( topLevelListPages.has( urlPath ) ) { |
| 29 | return ONE_MINUTE |
| 30 | } |
| 31 | |
| 32 | // Kind page |
| 33 | if ( requestUrl.pathname.startsWith( '/kind/' ) ) { |
| 34 | return ONE_MINUTE |
| 35 | } |
| 36 | |
| 37 | return ONE_SECOND |
| 38 | } |
| 39 | |
| 40 | export async function applyResponseDefaults ( Astro ) { |
| 41 | const maxAgeSeconds = getMaxAgeForUrl( Astro ) |
no test coverage detected