mirror of
https://github.com/honojs/hono.git
synced 2024-11-29 17:46:30 +01:00
0e1755c9e4
* feat: handle HEAD method
* remove `head` from `METHOS`
* fixed the lagon test
* show `depracated` message (will be removed next minor? version)
* denoify
* use `request.url`
* denoify
* Invoke dispatch() without changing request.method for HEAD method. (#1152)
* Invoke `dispatch()` without changing request.method for HEAD method.
* chore: denoify
* refactored
* denoify
* refactor: dispatch() arguments can no longer be omitted (#1156)
* Revert "refactored"
This reverts commit 2f8dacc42d
.
* refactor: `dispatch()` arguments can no longer be omitted
* denoifiy
---------
Co-authored-by: Taku Amano <taku@taaas.jp>
17 lines
477 B
TypeScript
17 lines
477 B
TypeScript
export const METHOD_NAME_ALL = 'ALL' as const
|
|
export const METHOD_NAME_ALL_LOWERCASE = 'all' as const
|
|
export const METHODS = ['get', 'post', 'put', 'delete', 'options', 'patch'] as const
|
|
|
|
export interface Router<T> {
|
|
name: string
|
|
add(method: string, path: string, handler: T): void
|
|
match(method: string, path: string): Result<T> | null
|
|
}
|
|
|
|
export interface Result<T> {
|
|
handlers: T[]
|
|
params: Record<string, string>
|
|
}
|
|
|
|
export class UnsupportedPathError extends Error {}
|