@tistory-skin-previewer/astro
Version:
Astro integration for Tistory skin previewing
22 lines (19 loc) • 630 B
JavaScript
;
var core = require('@tistory-skin-previewer/core');
// src/middleware.ts
var onRequest = async (context, next) => {
const response = await next();
if (response.headers.get("content-type")?.includes("text/html")) {
const html = await response.text();
const processedHtml = core.processHtml(html, context.url.pathname);
return new Response(processedHtml, {
status: response.status,
statusText: response.statusText,
headers: response.headers
});
}
return next();
};
exports.onRequest = onRequest;
//# sourceMappingURL=middleware.js.map
//# sourceMappingURL=middleware.js.map