MCPcopy Create free account
hub / github.com/ThatGuySam/doesitarm / getMaxAgeForUrl

Function getMaxAgeForUrl

helpers/astro/request.js:23–38  ·  view source on GitHub ↗
( Astro )

Source from the content-addressed store, hash-verified

21])
22
23function 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
40export async function applyResponseDefaults ( Astro ) {
41 const maxAgeSeconds = getMaxAgeForUrl( Astro )

Callers 1

applyResponseDefaultsFunction · 0.85

Calls 2

trimTrailingSlashFunction · 0.85
hasMethod · 0.80

Tested by

no test coverage detected