Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Only set htmlrewriter conditionally if it doesn't exist in the runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerflint committed Jan 4, 2024
1 parent f1516fc commit e3d9b28
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/endpoint-harness.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import Router, { Context } from '@qpoint/router';
import { HTMLRewriter } from 'htmlrewriter';
import { Queue } from './queue';

(globalThis as any).HTMLRewriter = HTMLRewriter;
// Ensure this runtime has an HTMLRewriter
if (!(globalThis as any).HTMLRewriter) {
await import('htmlrewriter').then(module => {
(globalThis as any).HTMLRewriter = module.HTMLRewriter;
});
}

/**
* The `EndpointHarness` class is designed for testing Qpoint middleware. It features a router
Expand Down

0 comments on commit e3d9b28

Please sign in to comment.