( Astro )
| 54 | |
| 55 | |
| 56 | export async function catchRedirectResponse ( Astro ) { |
| 57 | const requestUrl = new URL( Astro.request.url ) |
| 58 | |
| 59 | let netlifyRedirectUrl = null |
| 60 | |
| 61 | try { |
| 62 | netlifyRedirectUrl = await getNetlifyRedirect( requestUrl.pathname ) |
| 63 | } catch ( error ) { |
| 64 | console.warn( `Skipping redirect lookup for ${ requestUrl.pathname }`, error ) |
| 65 | } |
| 66 | |
| 67 | // console.log('netlifyRedirectUrl', netlifyRedirectUrl) |
| 68 | |
| 69 | if ( netlifyRedirectUrl !== null ) { |
| 70 | return Astro.redirect( netlifyRedirectUrl.to ) |
| 71 | } |
| 72 | |
| 73 | return null |
| 74 | } |
| 75 |
nothing calls this directly
no test coverage detected