The Response object to validate
TypeError if the response is not a valid HTML response
const htmlResponse = new Response('<html><body>Hello</body></html>', {
headers: { 'Content-Type': 'text/html' }
});
assertHtmlResponse(htmlResponse);
export function assertHtmlResponse(response: unknown): asserts response is Response {
if (!isHtmlResponse(response)) {
throw new TypeError("assertHtmlResponse| Invalid HTML response", { cause: response });
}
}
Asserts that a Response object contains HTML content. Throws a TypeError if the response is not a valid HTML response.