fix: routes/[...path] catches requests for _frsh/refresh.js (#130)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { ServerContext } from "../server.ts";
|
||||
import { REFRESH_JS_URL } from "../src/server/constants.ts";
|
||||
import { assert, assertEquals, assertStringIncludes } from "./deps.ts";
|
||||
import manifest from "./fixture_error/fresh.gen.ts";
|
||||
|
||||
@@ -31,3 +32,14 @@ Deno.test("error page rendered", async () => {
|
||||
assertStringIncludes(body, `Error: boom!`);
|
||||
assertStringIncludes(body, `at render`);
|
||||
});
|
||||
Deno.test("refresh.js rendered", async () => {
|
||||
const resp = await router(
|
||||
new Request("https://fresh.deno.dev" + REFRESH_JS_URL),
|
||||
);
|
||||
assert(resp);
|
||||
assertEquals(resp.status, 200);
|
||||
assertEquals(
|
||||
resp.headers.get("content-type"),
|
||||
"application/javascript; charset=utf-8",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
// To update this file, run `fresh manifest`.
|
||||
|
||||
import * as $0 from "./routes/index.tsx";
|
||||
import * as $1 from "./routes/[...all].ts";
|
||||
|
||||
const manifest = {
|
||||
routes: {
|
||||
"./routes/index.tsx": $0,
|
||||
"./routes/[...all].ts": $1,
|
||||
},
|
||||
islands: {},
|
||||
baseUrl: import.meta.url,
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Handlers } from "../../../server.ts";
|
||||
|
||||
export const handler: Handlers = {
|
||||
GET(_req, ctx) {
|
||||
return new Response(ctx.params.all);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user