-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from syumai/release-0.12.0
Release 0.12.0
- Loading branch information
Showing
13 changed files
with
42 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,28 @@ | ||
import { assertEquals } from "./vendor/https/deno.land/std/testing/asserts.ts"; | ||
import { App, get } from "./mod.ts"; | ||
import { redirect } from "./helpers.ts"; | ||
const { test, runTests } = Deno; | ||
|
||
const testPort = 8376; | ||
const host = `http://localhost:${testPort}`; | ||
const app = new App(testPort); | ||
|
||
app.serve(); | ||
Deno.test("Redirection does return new endpoint", async () => { | ||
const app = new App(testPort); | ||
app.serve(); | ||
|
||
test("Redirection does return new endpoint", async () => { | ||
const original_endpoint = "/original"; | ||
const new_endpoint = "/new_endpoint"; | ||
const expected_body = `body at ${new_endpoint}`; | ||
const originalEndpoint = "/original"; | ||
const newEndpoint = "/new_endpoint"; | ||
const expectedBody = `body at ${newEndpoint}`; | ||
|
||
app.register(get(original_endpoint, () => redirect(new_endpoint))); | ||
app.register(get(new_endpoint, () => expected_body)); | ||
app.register(get(originalEndpoint, () => redirect(newEndpoint))); | ||
app.register(get(newEndpoint, () => expectedBody)); | ||
|
||
const response = await fetch( | ||
`${host}${original_endpoint}`, | ||
`${host}${originalEndpoint}`, | ||
{ method: "GET" }, | ||
); | ||
|
||
assertEquals(response.status, 200); | ||
assertEquals((await response.text()), expected_body); | ||
}); | ||
assertEquals((await response.text()), expectedBody); | ||
|
||
(async () => { | ||
await runTests(); | ||
app.close(); | ||
})(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type ReadCloser = Deno.Reader & Deno.Closer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from 'https://deno.land/std@v0.40.0/encoding/utf8.ts'; | ||
export * from 'https://deno.land/std@v0.42.0/encoding/utf8.ts'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from 'https://deno.land/std@v0.40.0/flags/mod.ts'; | ||
export * from 'https://deno.land/std@v0.42.0/flags/mod.ts'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from 'https://deno.land/std@v0.40.0/http/server.ts'; | ||
export * from 'https://deno.land/std@v0.42.0/http/server.ts'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from 'https://deno.land/std@v0.40.0/testing/asserts.ts'; | ||
export * from 'https://deno.land/std@v0.42.0/testing/asserts.ts'; |