All files / apps/huella-legal/server/plugins cdn.ts

100% Statements 5/5
100% Branches 5/5
100% Functions 2/2
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12      7x 7x   7x   4x      
import type { H3Error } from "h3";
 
export default defineNitroPlugin((nitroApp) => {
    nitroApp.hooks.hook("error", (error, { event }) => {
        const { statusCode = 500 } = error as Partial<H3Error>;
 
        if (!event || statusCode < 500) return;
 
        setResponseHeader(event, "netlify-cdn-cache-control", "no-store");
    });
});