Skip to main content
Module

x/fastro/test/redirect_test.ts

Fast and simple web application framework for deno
Go to Latest
File
const { test } = Deno;import { assertEquals } from "../deps.ts";import { Fastro } from "../mod.ts";const addr = "http://localhost:8000";const port = 8000;
test({ name: "REDIRECT", async fn() { const server = new Fastro(); server.get("/", (req) => req.redirect(301, "/new")); server.get("/new", (req) => req.send("root")); server.listen({ port }); const result = await fetch(addr); const text = await result.text(); assertEquals(text, "root"); server.close(); },});