import { Pipeline } from "../pipeline.js"; class EndpointNotFoundError extends Error { originalResponse; constructor(originalResponse) { super(); this.originalResponse = originalResponse; } } class SSRRoutePipeline extends Pipeline { constructor(env) { super(env); this.setEndpointHandler(this.#ssrEndpointHandler); } // This function is responsible for handling the result coming from an endpoint. async #ssrEndpointHandler(request, response) { if (response.headers.get("X-Astro-Response") === "Not-Found") { throw new EndpointNotFoundError(response); } return response; } } export { EndpointNotFoundError, SSRRoutePipeline };