ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...

    Function assertHtmlResponse

    • Asserts that a Response object contains HTML content. Throws a TypeError if the response is not a valid HTML response.

      Parameters

      • response: unknown

        The Response object to validate

      Returns asserts response is Response

      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 });
      }
      }