Skip to content

Commit

Permalink
fix: use correct header for disabling pretty-error page in tests (#4117)
Browse files Browse the repository at this point in the history
Use `MF-Disable-Pretty-Error` instead of `MF-Original-URL` for
disabling the pretty-error page in the `additional-modules` fixture
test. This was changed in cloudflare/miniflare#689.
  • Loading branch information
mrbbot authored Oct 5, 2023
1 parent 9775043 commit 35760c3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fixtures/additional-modules/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ async function getTmpDir() {
type WranglerDev = Awaited<ReturnType<typeof runWranglerDev>>;
function get(worker: WranglerDev, pathname: string) {
const url = `http://${worker.ip}:${worker.port}${pathname}`;
// Setting the `MF-Original-URL` header will make Miniflare think this is
// coming from a `dispatchFetch()` request, meaning it won't return the pretty
// error page, and we'll be able to parse errors as JSON.
return fetch(url, { headers: { "MF-Original-URL": url } });
// Disable Miniflare's pretty error page, so we can parse errors as JSON
return fetch(url, { headers: { "MF-Disable-Pretty-Error": "true" } });
}

async function retry<T>(closure: () => Promise<T>, max = 30): Promise<T> {
Expand Down

0 comments on commit 35760c3

Please sign in to comment.