fix: parse multiple route params in same part (#1518)
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { startFreshServerExpectErrors } from "./test_utils.ts";
|
||||
import { dirname, join } from "$std/path/mod.ts";
|
||||
import { assertStringIncludes } from "./deps.ts";
|
||||
import { ServerContext } from "$fresh/server.ts";
|
||||
import manifest from "./fixture/fresh.gen.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
|
||||
const dir = dirname(import.meta.url);
|
||||
|
||||
@@ -16,3 +19,25 @@ Deno.test({
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
Deno.test("match route parameter and static", async () => {
|
||||
const handler = (await ServerContext.fromManifest(manifest, {})).handler();
|
||||
|
||||
const res = await handler(
|
||||
new Request("https://fresh.deno.dev/movies/foo.json"),
|
||||
);
|
||||
|
||||
assertEquals(await res.text(), "it works");
|
||||
assertEquals(res.status, 200);
|
||||
});
|
||||
|
||||
Deno.test("match multiple route parameters", async () => {
|
||||
const handler = (await ServerContext.fromManifest(manifest, {})).handler();
|
||||
|
||||
const res = await handler(
|
||||
new Request("https://fresh.deno.dev/movies/foo@bar"),
|
||||
);
|
||||
|
||||
assertEquals(await res.text(), "it works");
|
||||
assertEquals(res.status, 200);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user