-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve request API * Upgrade to Deno 0.19 * Fix lint errors * Run all tests in one process
- Loading branch information
Showing
14 changed files
with
714 additions
and
137 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
language: python | ||
|
||
install: | ||
- curl -fsSL https://deno.land/x/install/install.sh | sh -s v0.18.0 | ||
- curl -fsSL https://deno.land/x/install/install.sh | sh -s v0.19.0 | ||
- export PATH="$HOME/.deno/bin:$PATH" | ||
|
||
script: | ||
- deno test/server.js | ||
- deno test/router.js | ||
- deno test/toolkit.js | ||
- deno test.js |
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,5 +1,8 @@ | ||
import * as http from "https://deno.land/[email protected]/http/server.ts"; | ||
import { Status as status } from "https://deno.land/[email protected]/http/http_status.ts"; | ||
import { STATUS_TEXT as statusText } from "https://deno.land/[email protected]/http/http_status.ts"; | ||
import * as http from 'https://deno.land/[email protected]/http/server.ts'; | ||
import { Status as status, STATUS_TEXT as statusText } from 'https://deno.land/[email protected]/http/http_status.ts'; | ||
|
||
export { http, status, statusText }; | ||
export { | ||
http, | ||
status, | ||
statusText | ||
}; |
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,9 @@ | ||
import { assertEquals, assertStrictEq } from 'https://deno.land/[email protected]/testing/asserts.ts'; | ||
import { runTests, test } from 'https://deno.land/[email protected]/testing/mod.ts'; | ||
|
||
export { | ||
assertEquals, | ||
assertStrictEq, | ||
runTests, | ||
test | ||
}; |
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,41 @@ | ||
import Response from './response.js'; | ||
|
||
export default class Request { | ||
constructor(option) { | ||
this.raw = option.raw; | ||
this.route = option.route; | ||
this.method = this.raw.method; | ||
this.headers = this.raw.headers || new Headers({ host : 'localhost' }); | ||
this.params = this.route.params; | ||
this.response = new Response(); | ||
this.server = option.server; | ||
this.url = new URL(this.raw.url, 'http://' + this.headers.get('host')); | ||
} | ||
body(...args) { | ||
return this.raw.body(...args); | ||
} | ||
bodyStream(...args) { | ||
return this.raw.bodyStream(...args); | ||
} | ||
get host() { | ||
return this.url.host; | ||
} | ||
get hostname() { | ||
return this.url.hostname; | ||
} | ||
get href() { | ||
return this.url.href; | ||
} | ||
get origin() { | ||
return this.url.origin; | ||
} | ||
get path() { | ||
return this.url.pathname; | ||
} | ||
get search() { | ||
return this.url.search; | ||
} | ||
get searchParams() { | ||
return this.url.searchParams; | ||
} | ||
} |
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
Oops, something went wrong.