Yusuke Wada
48a8729862
perf(hono-base): use constructor.name
instead of instanceof
( #1311 )
...
* perf(hono-base): use `constructor.name` instead of `instanceof`
* denoify
2023-08-10 10:10:40 +09:00
Tim Fish
9be3b7b6dd
Add missing wasm mime type ( #1307 )
...
* Add missing wasm mime type
* deno dist
2023-08-09 21:45:07 +09:00
Yusuke Wada
a104bf0010
fix(netlify): fix import paths ( #1304 )
2023-08-08 09:35:05 +09:00
Yusuke Wada
f7bce19751
fix(validator): support async validator func ( #1303 )
...
* fix(validator): support async validator func
* denoify
2023-08-07 21:26:53 +09:00
Yusuke Wada
85f8ab663f
refactor(app): add "deprecate message" for app.handleEvent()
( #1298 )
...
* refactor(app): add "deprecate message" for `app.handleEvent()`
* denoify
2023-08-05 23:41:45 +09:00
Yusuke Wada
4a3c5834de
chore(benchmark): update the handle-event benchmark ( #1297 )
...
* chore(benchmark): update the handle-event benchmark
* denoify
2023-08-05 23:37:41 +09:00
Yusuke Wada
8e2eaf9d24
docs(jsdoc): fix a app.route()
JSDoc description ( #1296 )
...
* docs(jsdoc): fix a `app.route()` JSDoc description
* denoify
2023-08-05 23:28:34 +09:00
Yusuke Wada
8b0f189a3f
refactor(json-pretty): don't use c.pretty()
( #1288 )
2023-08-05 18:14:57 +09:00
Yusuke Wada
09368ac9cc
feat(adapter): add Netlify adapter ( #1290 )
...
* feat(adapter): add Netlify adapter
* denoify
2023-08-05 18:12:02 +09:00
Yusuke Wada
85b54920f9
feat(parseBody): allow passing generics to parseBody()
( #1289 )
...
* feat(parseBody): allow passing generics to `parseBody()`
* denoify
2023-08-05 18:10:12 +09:00
Torsten Engelbrecht
35246d0de6
feat(middleware): Simple cookie signing functionality ( #1279 )
2023-08-05 17:19:08 +09:00
Yusuke Wada
47ae014724
perf(context): add init
flag ( #1284 )
...
* perf(context): add `init` flag
* denoify
2023-08-04 00:09:12 +09:00
Yusuke Wada
d5cfe040d8
fix(types): add a missing handler type ( #1283 )
...
* fix(types): add a missing handler type
* fix & denoify
2023-08-03 23:09:58 +09:00
watany
4f7d027f5b
doc(readme): adding Lambda@Edge ( #1278 )
2023-08-01 10:38:28 +09:00
Yusuke Wada
e851e9bd82
perf(utils/url): use regexp instead of indexOf()
( #1276 )
...
* perf(utils/url): use regexp instead of `indexOf()`
* remove unused file
* denoify
2023-07-29 23:38:55 +09:00
Yusuke Wada
8ea833a7d0
refactor(hono-base): remove async/await from app.request
( #1275 )
...
* refactor(hono-base): remove async/await from `app.request`
* denoify
2023-07-28 17:52:11 +09:00
Yusuke Wada
77b7ac7fe7
fix(utils/filepath): allow ..
in filename ( #1272 )
...
* fix(utils/filepath): allow `..` in filename
* denoify
* support `./foo../bar.txt`
* denoify
* add tests
---
Co-authored-by: Taku Amano <taku@taaas.jp>
2023-07-27 11:43:42 +09:00
Yusuke Wada
614ab9d6e4
fix(utils/filepath): don't allow dot segments ( #1271 )
2023-07-27 08:37:20 +09:00
Codinak
1495f8b41b
fix(jsx): escapeToBuffer vulnerability ( #1266 )
...
* fix escapeToBuffer vulnerability
Escape single quote (0x27) to limit execution capabilities under certain conditions.
* denoify
2023-07-26 23:12:25 +09:00
Yusuke Wada
b0a368676e
fix(hono-base): enable strict
with getPath
option ( #1259 )
...
* fix(hono-base): enable `strict` with `getPath` option
* denoify
2023-07-23 16:03:45 +09:00
Yusuke Wada
5c1f7f033c
fix(hono/quick): use SmartRouter ( #1250 )
...
* fix(hono/quick): use SmartRouter
* denoify
2023-07-20 17:43:35 +09:00
Yusuke Wada
47dbeaa147
fix(trie-router-router): For "Named param with trailing wildcard" ( #1246 )
...
* fix(trie-router-router): For "Named param with trailing wildcard"
* denoify
2023-07-20 16:48:38 +09:00
Taku Amano
3e663af916
fix(pattern-router): For "Named param with trailing wildcard" ( #1244 )
...
* fix(pattern-router): For "Named param with trailing wildcard"
* chore: denoify
2023-07-20 16:48:21 +09:00
James A Rosen
4b39eba618
refactor(etag): simplify cloning logic ( #1242 )
...
If the upstream response doesn't include an `ETag` header, the ETag
middleware needs to clone the response so it can read the body to
compute an ETag. This commit simplifies the management of the original
and cloned responses.
2023-07-19 09:57:57 +09:00
markthree
0efc6952a3
perf(deno/middlewares/serveStatic): serve static with stream ( #1234 )
...
* perf(deno/middlewares/serveStatic): serve static with stream
* Revert "perf(deno/middlewares/serveStatic): serve static with stream"
This reverts commit 0360966d1e
.
* fix(deno/middlewares/serveStatic): fix position and test for serve static with stream
* chore(deno/middlewares/serveStatic): clean temp dist files
2023-07-15 14:28:48 +09:00
Yusuke Wada
42dc3646a0
fix(cache): clone the response ( #1232 )
...
* fix
* clone the response shortly
* add test for not found
* denoify
---------
Co-authored-by: brn <brn@b6n.ch>
2023-07-15 09:36:03 +09:00
Yusuke Wada
cef0adb1d6
fix(mount): include query params ( #1224 )
...
* fix(mount): include query params
* denoify
2023-07-08 18:25:50 +09:00
Pascal
b0e0ce85a0
feat: Add Server-Timing API as middleware ( #1215 )
...
* feat(timing): add Server-Timing API as middleware
* refactor(timing): rename config to TimingOptions
2023-07-03 11:19:49 +09:00
flow
d6f4d1a501
Fix replaceUrlParam to ignore regexp in path ( #1214 )
...
* Fix replaceUrlParam to ignore regexp in path
* Generate deno_dist files
2023-07-02 22:25:19 +09:00
Yusuke Wada
8ebd8b7b76
fix(jsonT
): remove overloads from JSONTRespond
( #1208 )
...
* fix(`jsonT`): remove overloads from `JSONTRespond`
* denoify
* update tests
2023-06-29 20:09:00 +09:00
ryoppippi
bae5419d54
feat: add deleteCookie ( #1190 )
...
* add deleteCookie
* fix test
* fix test
* add test for deteleCookie with third argument opt
2023-06-29 19:58:38 +09:00
Yusuke Wada
5b873fcc5c
fix(types): allow not to set skipLibCheck
( #1206 )
...
* fix(types): allow not to set `skipLibCheck`
* use `unknown`
* denoify
2023-06-29 16:48:00 +09:00
James A Rosen
ddc34e1f6a
perf(Request): optimize Request.prototype.header ( #1204 )
...
`Request.prototype.header` has two overloads:
1. with a string name, it returns that header value if present
2. with no argument, it returns all the headers as an object
Previously, the implementation built the whole object for (2) even when
returning a single header. This was wasteful. This commit changes it to
return the header by name if specified and only iterate over all the
headers when the caller asks for the whole object.
2023-06-29 16:27:05 +09:00
James A Rosen
f356702efc
fix(etag): support multi-value If-None-Match ( #1199 )
...
* chore(etag): reduce global state in tests
Previously, the `etag` tests used a single Hono `app` that was
instantiated statically before the tests. Having a shared app increases
the chances of inter-test conflicts and makes it impossible to modify
the app for a single test. This, in turn, makes it harder for test
maintainers to see the connection between the app configuration and the
expectations.
This commit moves the creation of the `app` into a `beforeEach` block
and moves any app configuration that relates to a single test case into
that test case.
* perf(etag): don't override ETags from upstream
Previously, the `etag` middleware would always compute an `ETag`
header based on the SHA-1 of the `Response` body. In cases where the
upstream response already includes the header, this wastefully
clones the response, reads the body into memory, and computes a hash.
This commit changes the middleware to bypass the hash computation if
the `Response` already has an ETag.
* perf(etag): 304s include only necessary headers
The spec[^1] for 304 Not Modified says,
> The server generating a 304 response MUST generate any of the
> following header fields that would have been sent in a 200 (OK)
> response to the same request:
>
> * Content-Location, Date, ETag, and Vary
> * Cache-Control and Expires (see [CACHING])
>
> Since the goal of a 304 response is to minimize information transfer
> when the recipient already has one or more cached representations, a
> sender SHOULD NOT generate representation metadata other than the
> above listed fields unless said metadata exists for the purpose of
> guiding cache updates (e.g., Last-Modified might be useful if the
> response does not have an ETag field).
Previously, the `etag` middleware was sending all headers from the
original response except for `content-type` (omitted by
`Context.prototype.set res`) and `content-length` (omitted by the `etag`
middleware itself).
This commit changes the middleware to include only the headers
required with the spec, upgrading it from _conditionally compliant_ to
_fully compliant_. The list is configurable as
`options.retainedHeaders`.
[^1]: https://www.rfc-editor.org/rfc/rfc9110#name-304-not-modified
* fix(etag): Support multi-value If-None-Match
The spec[^1] for `If-None-Match` says,
> If the field value is a list of entity tags, the condition is false if
> one of the listed tags matches the entity tag of the selected
> representation.
and provides these examples:
```
If-None-Match: "xyzzy"
If-None-Match: W/"xyzzy"
If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
If-None-Match: *
```
The value `*` isn't relevant for this middleware, but the other values
are.
This commit adds support for multi-value comma-separated ETags in the
`If-None-Match` header.
[^1]: https://www.rfc-editor.org/rfc/rfc9110#name-if-none-match
* perf(etag): prefer Header.prototype.get
Previously, the `etag` middleware used `c.req.header(...)` to access the
`If-None-Match` header. This method works, but is less efficient than
accessing the value via the raw `Headers` object.
Additionally, the middleware was trying multiple case versions for the
same header, but header-lookup is case-insensitive, so it was wasting
time on requests that lacked the header altogether.
This change also makes `etag` consistent with the other middleware in
this repo (e.g. `basic-auth`, `compress`), which all use
`c.req.headers.get(...)` to access headers.
2023-06-29 16:23:26 +09:00
Yusuke Wada
ee5929b045
fix(tsconfig): remove skipLibCheck
( #1201 )
2023-06-26 17:14:40 +09:00
Yusuke Wada
4b2dfb824b
fix(utils/cookie): allow 0 to maxAge ( #1196 )
...
* fix(utils/cookie): allow 0 to maxAge
* denoify
2023-06-23 17:33:20 +09:00
Yusuke Wada
e2b26d6074
fix(cookie): maxAge
should be positive ( #1194 )
...
* Allow setting cookie's maxAge to 0.
* fix(cookie): `maxAge` should be positive
* denoify
---------
Co-authored-by: David Manouchehri <david.manouchehri@ai.moda>
2023-06-22 22:37:07 +09:00
Kelly Littlepage
387d696303
fix: application/x-www-form-urlencoded decoding ( #1189 )
...
The current logic for decoding application/x-www-form-urlencoded is
overly restrictive and misses `Content-Type` headers with a character
encoding set, i.e., application/x-www-form-urlencoded; charset=UTF-8.
This fix harmonizes the logic for handling multipart/form-data
and application/x-www-form-urlencoded in the `parseBody` method of
request objects.
2023-06-21 22:51:59 +09:00
Yusuke Wada
5f9453b498
feat(jsx): React-like style
conversion ( #1159 )
...
* feat(jsx): React-like `style` conversion
* denoify
2023-06-07 21:56:04 +09:00
IGUCHI Kanahiro
a6b0833060
fix: avoid range-error ( #1168 )
...
* fix: avoid range-error
* fix: avoid range-error
* denoify
2023-06-07 21:54:49 +09:00
Alexander Kozlov
8387b8c0f6
fix(HttpException): error message should not be the HTTP reason phrase ( #1161 )
...
* fix(HttpException): error message should not be the HTTP reason phrase
* review fixes
---------
Co-authored-by: Nasa <nasa@mail.inc>
2023-06-07 21:17:52 +09:00
ayame113
81d271279c
feat: Allow context.jsonT
to take interface as an argument ( #1162 )
2023-06-06 10:23:09 +09:00
Taku Amano
8a1b9aa9a8
refactor: Tweaks variable names to reduce code. ( #1157 )
...
* refactor: Tweaks variable names to reduce code.
* Delete meaningless comments
* chore: denoify
2023-06-04 09:16:29 +09:00
Yusuke Wada
2d6abaff5c
fix(tire-router/pattern-router): fixed the named capture issue ( #1148 )
...
* fix(trie-router): fixed the named capture issue
* denoify
* denoify
* refactor(pattern-router): Use Object.assign for shortening the code. (#1154 )
* refactor(pattern-router): Use `Object.assign` for shortening the code.
* chore: denoify
---------
Co-authored-by: Taku Amano <taku@taaas.jp>
2023-06-03 09:08:01 +09:00
Yusuke Wada
0e1755c9e4
feat: handle HEAD method ( #1142 )
...
* 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>
2023-06-03 09:07:33 +09:00
Taku Amano
2ff0605382
fix(reg-exp-router): Register static paths first for duplicate checking. ( #1146 )
...
* fix(reg-exp-router): Register static paths first for duplicate checking.
* chore: denoify
2023-06-01 17:37:19 +09:00
Yudai Nakata
c09dbc060b
feat: define JSX.ElementChildrenAttribute interface ( #1139 )
...
* feat: define JSX.ElementChildrenAttribute interface
* chore: denoify
2023-05-29 22:00:27 +09:00
Yusuke Wada
f251706e6e
fix(deno): export types for the client ( #1137 )
2023-05-28 08:44:50 +09:00
Dmitry Poklonskiy
2a2f73a1c4
fix: Add missing client types and TypedResponse type ( #1135 )
2023-05-28 08:39:36 +09:00
Yusuke Wada
8f5ba57d0c
fix(middleware): don't use headers.append()
, use headers.set()
( #1129 )
...
* fix(middleware): don't use `c.res.headers.append()`, use `set()`
* denoify
2023-05-24 18:01:19 +09:00
Yusuke Wada
ded33157bc
fix: export PatternRouter
and LinearRouter
( #1128 )
2023-05-24 16:05:50 +09:00
Yusuke Wada
4f8ed4201e
chore: denoify ( #1124 )
2023-05-22 11:40:51 +09:00
Yusuke Wada
2cfafe9642
fix(basic-auth): handle passing invalid value to atob()
( #1122 )
...
* fix(basic-auth): handle passing invalid value to `atob()`
* chore: denoify
2023-05-21 20:48:35 +09:00
Yusuke Wada
1c44c6ec46
Revert "feat(deno): export cookie middleware ( #1103 )"
...
This reverts commit 9a4af5ea00
.
Fix #1120
2023-05-21 01:47:34 +09:00
Yusuke Wada
127fa30dce
fix(app): app.mount()
supports /
( #1119 )
...
* fix(app): `app.mount()` supports `/`
* chore: denoify
2023-05-20 15:29:58 +09:00
Yusuke Wada
2e6064703b
docs(readme): update ( #1115 )
...
* docs(readme): update
* denoify
2023-05-19 12:07:18 +09:00
Yusuke Wada
84f8bc6fc8
fix(router): PatternRouter
supports a hostname, added tests ( #1114 )
...
* fix(router): `PatternRouter` supports a hostname, added tests
* denoify
2023-05-18 15:03:35 +09:00
Yusuke Wada
4fde03e22f
fix(preset): fix constructor args ( #1113 )
...
* fix(preset): fix constructor args
* chore: denoify
2023-05-18 14:18:55 +09:00
Yusuke Wada
a2d22807e4
feat: app.mount()
( #1104 )
...
* feat: `mount()`
* update tests
* check header values
* chore: denoify
* make it as `app.mount()`
* denoify
* Generate new URL more simply. (#1112 )
* Generate new URL more simply.
* chore: denoify
---------
Co-authored-by: Taku Amano <taku@taaas.jp>
2023-05-18 14:03:50 +09:00
Yusuke Wada
390d05b006
feat(app): app.routerName()
( #1105 )
...
* feat(context): `c.routerName()`
* chore: denoify
* Enable to get router name via `app.routerName`. (#1110 )
---------
Co-authored-by: Taku Amano <taku@taaas.jp>
2023-05-18 00:05:28 +09:00
Yusuke Wada
a538d4ad81
fix(app): export fire()
correctly ( #1106 )
2023-05-17 06:55:30 +09:00
Yusuke Wada
9a4af5ea00
feat(deno): export cookie middleware ( #1103 )
...
* feat(deno): export cookie middleware
* chore: denoify
2023-05-14 12:52:55 +09:00
Yusuke Wada
39bf73841f
docs: update readme
2023-05-14 12:37:21 +09:00
Yusuke Wada
ccc4308871
fix(types): set /
for generics basePath
( #1083 )
...
* fix(types): set `/` for generics `basePath`
* denoify
* fix `MergePath`
* tweak
* denoify
2023-05-14 08:18:45 +09:00
Yusuke Wada
e785fe8d81
feat(app): onError()
supports async ( #1090 )
...
Co-authored-by: Ali Kaan Tunçel <alikaan.net@hotmail.com>
2023-05-14 08:16:28 +09:00
Yusuke Wada
220c956272
Merge branch 'main' into next
2023-05-11 17:53:05 +09:00
Taku Amano
c25745c6fa
fix(context): Fix typo in charset, again. ( #1086 )
...
* fix(context): Fix typo in charset.
* chore: denoify
2023-05-10 08:27:40 +09:00
Taku Amano
b15638c37c
fix(getQueryParam): Fixed a bug in getQueryParam when a partial matching key was found. ( #1085 )
...
* fix(getQueryParam): Fixed a bug in getQueryParam when a partial matching key was found.
* chore: denoify
2023-05-10 08:26:17 +09:00
Yusuke Wada
f26630a61b
fix: remove type.ts
( #1082 )
...
* fix: remove not used `type.ts`
* denoify
2023-05-09 22:22:12 +09:00
Yusuke Wada
187cb7ed5b
chore: denoify
2023-05-09 22:15:10 +09:00
Yusuke Wada
bcc08081ef
fix(context): enable extending ContextVarableMap
( #1080 )
...
* fix(context): enable extending `ContextVarableMap`
* denoify
2023-05-09 21:55:40 +09:00
Yusuke Wada
d9aca261a1
fix: enable specifying router from args ( #1079 )
...
* fix: enable specifying router from args
* add tests
* denoify
2023-05-09 21:50:43 +09:00
Yusuke Wada
116aea542d
Merge branch 'main' into next
2023-05-05 17:46:30 +09:00
Yusuke Wada
a73f0d23f0
feat: Cookie Middleware and deprecate c.req.cookie()
/ c.cookie()
( #1066 )
...
* feat: add Cookie Middleware and deprecate `c.req.cookie()` / `c.cookie()`
* chore: denoify
2023-05-05 11:08:03 +09:00
Yusuke Wada
c50dcf03bb
fix(jsx): fix a jsx-runtime
bug ( #1070 )
...
* fix(jsx): fix a `jsx-runtime`
* fixed for Bun
* denoify
2023-05-05 10:46:49 +09:00
Yusuke Wada
21f4c196e7
feat(serve-static): rewriteRequestPath
option for Workers/Deno/Bun ( #1065 )
2023-05-03 23:05:21 +09:00
Yusuke Wada
55684f4b9f
chore: denoify
2023-05-03 22:19:24 +09:00
Taku Amano
b253a8735b
feat: Allow getPath to be replaced. ( #1064 )
...
* feat: Allow getPath to be replaced.
* chore: denoify
2023-05-03 22:13:23 +09:00
Yusuke Wada
95195801c4
Merge branch 'main' into next
2023-05-02 20:20:57 +09:00
Yusuke Wada
e066719aa1
fix(deno): export HTTPException
from mod.ts
( #1058 )
...
* fix(deno): export `HTTPException` from `mod.ts`
* denoify
2023-05-02 16:37:24 +09:00
Yusuke Wada
d06a3123e7
Merge branch 'main' into next
2023-05-02 16:30:24 +09:00
Yusuke Wada
85528398c3
fix: check global.fastly
instead of require('fastly:env')
( #1057 )
...
* fix: use `global.fastly` instead of `require('fastly:env')`
* denoify
2023-05-02 16:26:39 +09:00
Alex Errant
7c6ebe8f4e
fix: empty string is a valid header value ( #1056 )
...
* empty string is a valid header value
* yarn denoify
2023-05-02 15:56:17 +09:00
Yusuke Wada
64ddf093d6
perf: use ===
instead of startsWith
and endsWith
( #1053 )
2023-04-30 21:18:32 +09:00
Yusuke Wada
0a19deaa5b
perf: shorten code ( #1051 )
2023-04-30 21:07:00 +09:00
Taku Amano
1a1de75296
feat: Introduce LinearRouter. ( #1043 )
...
* feat: Introduce LinearRouter.
* chore: Add benchmark script.
* chore: denoify
2023-04-28 12:10:20 +09:00
Yusuke Wada
03df736763
feat(utils): remove HTTP status messages from http-status.ts
( #1037 )
...
* feat(utils): remove HTTP status messages from `http-status.ts`
* denoify
2023-04-28 12:10:20 +09:00
Yusuke Wada
677b572fd5
feat: introduce PatternRouter and hono/tiny
( #1036 )
...
* wip
* Use RegExp instead of URLPattern. (#1039 )
* Use RegExp instead of URLPattern.
* refactor(url-pattern-router): tidy up.
* refactor(url-pattern-router): Tweaks type for mangling.
* refactor: Rename URLPatternRouter to PatternRouter.
* chore: denoify.
---------
Co-authored-by: Taku Amano <taku@taaas.jp>
2023-04-28 12:10:20 +09:00
Taku Amano
ac7eeda87f
fix(context): Fix typo in charset. ( #1046 )
2023-04-28 12:06:23 +09:00
Yusuke Wada
ea7ece39eb
docs(readme): fixed readme for Deno
2023-04-17 08:51:53 +09:00
Yusuke Wada
e6669f7779
feat(jwt): support for getting payload from c.get('jwtPayload')
( #1025 )
2023-03-31 18:39:26 +09:00
Yusuke Wada
c503436276
feat(deno): denoify ( #1024 )
2023-03-31 18:17:45 +09:00
Taku Amano
0560f27bde
fix(utils/url): Fix behavior when parameters with no value specified are mixed. ( #1023 )
...
* refactor(utils/url): Reduce a few characters.
* fix(utils/url): Fix behavior when parameters with no value specified are mixed.
* chore: denoify
2023-03-31 17:57:24 +09:00
Taku Amano
91c04ac073
refactor(utils/url): Decode parameters more accurately without performance degradation. ( #1015 )
...
* refactor(utils/url): Decode parameters more accurately without performance degradation.
* Add tests about getQueryParam and getQueryParams.
* chore(bench): add query param bench
* chore: denoify
2023-03-29 23:03:00 +09:00
Yusuke Wada
813984edca
denoify
2023-03-26 22:14:33 +09:00
Yusuke Wada
282e18596b
fix(app): don't remove slash form /
if strict is false ( #1004 )
...
* fix(app): don't remove slash form `/` if strict is `false`
* fixed test
* denoify
2023-03-20 23:30:41 +09:00
Kei Kamikawa
95602a18d7
feat: support issued_at
validation for JWT ( #1001 )
...
* added issued at validation
* yarn denoify
2023-03-20 23:29:32 +09:00
Yusuke Wada
309c38a69a
denoify
2023-03-19 18:19:01 +09:00
Taku Amano
c0af3d0726
feat: Enable to add subApp with basePath. ( #998 )
...
* feat: Enable to add subApp with basePath.
* chore: denoify.
2023-03-19 12:39:07 +09:00
Yusuke Wada
e0cead6100
fix(context): fixed a bug for c.header()
with a append
option ( #997 )
...
* fix(context): fixed a bug for `c.header()` with a `append` option
* denoify
2023-03-19 12:08:17 +09:00
Yusuke Wada
0238dc6b91
feat(req): introduce c.req.path
( #988 )
...
* feat(req): introduce `c.req.path`
* denoify
* we don't have to handle fragments
* fixed the test
* denoify
2023-03-17 16:32:19 +09:00
Yusuke Wada
cadb6eab41
feat(validator): query
supports array params ( #984 )
...
* feat(validator): `query` supports array params
* denoify
2023-03-16 21:49:28 +09:00
Taku Amano
287498bdec
feat(validator): Allow validator to apply validation to path param. ( #982 )
...
* Allow validator to apply validation to path param.
* chore: denoify
* feat(validator): Enable passing the path to ValidationFunction as a template parameter.
* chore: denoify
Co-authored-by: yusukebe <yusuke@kamawada.com>
2023-03-15 22:20:50 +09:00
Yusuke Wada
e2a174b8ac
fix(types): infer types correctly ( #983 )
...
* v3.1.0-rc.2
* fix(types): infer path param types correctly
* denoify
* fix: infer the value type in the validation funtion
* denoify
2023-03-14 23:43:33 +09:00
Yusuke Wada
014acdc081
fix(client): removeIndexString
supports /sub/index
( #978 )
...
* fix(client): `removeIndexString` supports `/sub/index`
* denoify
2023-03-13 22:37:17 +09:00
Yusuke Wada
3bb918b27c
fix(types): make MergePath<'/api', '/'>
work well ( #971 )
...
* fix(types): make `MergePath<'/api', '/'>` work well
* denoify and remove some lines
2023-03-13 22:21:03 +09:00
Yusuke Wada
ea7a1b2d95
refactor: remove lint warnings ( #976 )
2023-03-13 22:08:16 +09:00
Yusuke Wada
418941d01b
Merge branch 'main' into next
2023-03-13 22:00:00 +09:00
Yusuke Wada
948ca6a3b5
fix(route): support a root-level optional parameter ( #975 )
...
* fix(route): support a root level optional parameter
* denoify
2023-03-13 21:55:01 +09:00
Yusuke Wada
5cb8bf12fd
Merge branch 'main' into next
2023-03-13 09:54:55 +09:00
Yusuke Wada
4414e63246
fix(etag): returns correct headers ( #973 )
...
* fix(etag): returns correct headers
* denoify
* `Etag` to `ETag`
2023-03-13 09:48:44 +09:00
Yusuke Wada
9c4197a772
feat(validator): support type transformation ( #969 )
...
* feat(validator): support type transformation
* denoify
* create `ValidationFunction` and add a test
* denoify
* rename
* denoify
2023-03-11 22:17:08 +09:00
Yusuke Wada
7548eaa0f6
feat(context): allow passing RequestInit
to c.json()
etc. ( #959 )
...
* feat(context): allow passing `RequestInit` to `c.json()` etc.
* denoify
resolve #952
2023-03-09 23:54:47 +09:00
Yusuke Wada
95f6470d5b
fix(type): add forgotten BasePath
( #967 )
...
* fix(type): add forgotten `BasePath`
* denoify
2023-03-09 10:52:22 +09:00
Taku Amano
55baf9d2d3
feat: route()
with one argument is renamed basePath()
. ( #964 )
...
* feat: `route()` with one argument is renamed `basePath()`.
* chore: denoify.
* refactor: Use `private` instead of hard private fields.
* refactor: The `route()` with one argument has reverted and deprecated.
* chore: denoify
2023-03-09 09:41:11 +09:00
Yusuke Wada
ad880dba43
feat: env
support enviroment variables for multi runtimes ( #949 )
...
* feat: `env` support enviroment variables for multi runtimes
* typo
* denoify
* fixed ci settings
* fixed deno command
* comment out lagon test
* remove warnings
2023-03-06 21:12:22 +09:00
Yusuke Wada
b8c92e42ed
Merge branch 'main' into next
2023-03-06 20:42:43 +09:00
Yusuke Wada
fea78f29bd
docs(readme): add creator name of RegExpRouter and SmartRouter ( #956 )
...
* docs(readme): add creator name of RegExpRouter and SmartRouter
* denoify
2023-03-06 20:42:05 +09:00
Yusuke Wada
c996f2d542
denoify
2023-03-05 23:40:14 +09:00
Yusuke Wada
4fb8151663
feat(context): allow passing unknown
to executionCtx.waitUntil
( #957 )
...
* feat(context): allow passing `Promise<unknown>` to `executionCtx.waitUntil`
* denoify
2023-03-05 23:37:02 +09:00
Yusuke Wada
cd1d4530a3
docs(readme): denoify
...
[skip ci]
2023-03-02 21:52:25 +09:00
Yusuke Wada
46c233e463
fix(client): show type error if $get()
needs args ( #937 )
...
* fix(client): show type error if `$get()` needs args
* denoify
2023-03-02 21:40:53 +09:00
Yusuke Wada
b1c5059708
feat(jsonT
): check JSON type ( #939 )
...
* feat(`jsonT`): check JSON type
* denoify
* use `JSONValue`
* create `TrueAndFalseToBoolean` and add a comment
2023-03-02 08:56:13 +09:00
tangye
73860a1595
fix: let the app.request behave the same as fetch ( #933 )
...
* fix: let the app.request behave the same as fetch
* fix: add deno dist files
---------
Co-authored-by: 唐烨 <tangye@xinpianchang.com>
2023-02-27 20:01:04 +09:00
Yusuke Wada
7ba91208b9
fix: add missing MergePath
( #936 )
...
* fix: add missing `MergePath`
* denoify
2023-02-27 19:10:16 +09:00
Taku Amano
b0501e03cd
feat: Improve route() ( #929 )
...
* feat: return a sub app cloning itself from route()
* feat: Add extra type parameter BasePath.
* refactor: The type of hono.basePath may simply be a string.
* refactor: first argument of route is required, default value is not required
* chore: denoify
2023-02-27 18:38:27 +09:00
Yusuke Wada
e035e289ee
feat(deno): export HonoRequest
type in Deno ( #927 )
2023-02-25 02:48:18 +09:00
Yusuke Wada
b788fe619f
fix(validator): clone Request object if json
or form
( #926 )
2023-02-25 02:36:11 +09:00
Yusuke Wada
b9227b890c
refactor(util): remove using Buffer
from encode.ts
( #925 )
2023-02-25 01:53:18 +09:00
Yusuke Wada
b3868d1075
fix(types): app.route
with multiple endpoints returns types correctly ( #919 )
...
* fix(types): `app.route` with multiple endpoints returns types correctly
* fix `OnHandlerInterface` patterns too.
* denoify
* fix type mismatch of Env
* remove unnecessary assert
2023-02-24 09:07:25 +09:00
hagishi
14ed9f7368
feat: allow pathname argument ( #921 )
...
* feat: allow pathname argument
* fix: add control input argument
* denoify
2023-02-23 23:41:50 +09:00
Jonas Hiltl
17755d8167
feat: Custom fetch method for Hono Client options ( #920 )
...
* Allow setting custom fetch method for hono client
* Run yarn denoify
2023-02-23 16:26:25 +09:00
Yusuke Wada
4c4bf2b85e
docs(readme): add "quick start"
2023-02-23 05:49:16 +09:00
Yusuke Wada
2c5b9891bd
feat(types): keep schema info with app.route()
( #909 )
2023-02-20 08:56:29 +09:00
hagishi
7ffb5b547e
feat(client): Inject common headers ( #908 )
...
* feat(client): Inject common headers
* feat: Accept a RequestOptions object as argument.
* refactor: Rename RequestOption to RequestOptions
* denoify
2023-02-20 08:22:01 +09:00
Yusuke Wada
02e3786016
docs(readme): update for v3 ( #902 )
...
* docs(readme): update for v3
* denoify
2023-02-18 08:27:54 +09:00
Yusuke Wada
c98f71610a
fix(jsx): declare types for JSX correctly ( #901 )
2023-02-18 06:50:52 +09:00
Yusuke Wada
6d8bd62d23
chore: honojs.dev
to hono.dev
( #900 )
2023-02-16 23:18:34 +09:00
Yusuke Wada
d4e3728881
chore: denoify
2023-02-16 18:08:50 +09:00
Yusuke Wada
79759a81ed
feat(client): introduce Fetch
type ( #898 )
...
* feat(client): introduce `Fetch` type
* denoify
2023-02-16 16:12:21 +09:00
Yusuke Wada
94df5fce68
feat(hc): add InferRequestType
( #894 )
...
* feat(hc): add `InferRequestType`
* denoify
2023-02-15 08:47:40 +09:00
Yusuke Wada
05ee837f78
feat: change the arg InferResponseType
receives ( #893 )
...
* feat: change the arg `InferResponseType` receives
* denoify
2023-02-15 07:05:39 +09:00
Yusuke Wada
733854f6cb
docs(readme): add bundlephobia badges ( #891 )
2023-02-14 22:50:58 +09:00
Yusuke Wada
68cbbbcde7
refactor: rename ValidationTypes
to ValidationTargets
( #890 )
...
* refactor: rename `ValidationTypes` to `ValidationTargets`
* denoify
2023-02-14 06:21:30 +09:00
Yusuke Wada
5b29d4235e
refactor: rename to TypedResponse
( #889 )
...
* refactor: rename to `TypedResponse`
* denoify
2023-02-13 21:57:12 +09:00
Yusuke Wada
60c0903a1c
fix(req): query return type as string | undefined
( #888 )
...
* fix(req): return type as `string | undefined`
* denoify
2023-02-13 21:40:51 +09:00
Yusuke Wada
0b2ac1678e
Merge branch 'main' into next
2023-02-13 06:47:05 +09:00
Alex Errant
d2abad3b34
header may return undefined ( #884 )
...
* header may return undefined
* fixed broken tests
* yarn denoify
* update CONTRIBUTING
2023-02-13 06:30:57 +09:00
Yusuke Wada
e0059916e9
fix(deno): allow {}
for app.fetch
fo compatibility ( #887 )
2023-02-12 16:46:47 +09:00
Yusuke Wada
23b05425da
fix(deno): export deno adapter ( #886 )
2023-02-12 16:35:22 +09:00
Yusuke Wada
39e855f0a4
feat: move http-exception out of utils ( #883 )
2023-02-11 18:05:50 +09:00
Yusuke Wada
ff7b225620
feat(app
): support multiple methods with app.on()
( #882 )
...
* feat(`app`): support multiple methods with `app.on()`
* use `flat()`
* denoify
2023-02-11 16:20:11 +09:00
Yusuke Wada
17af727d49
feat(validator): moved validator outside of middleware ( #879 )
2023-02-11 01:18:27 +09:00
Yusuke Wada
6f729895a7
merge main into next
2023-02-09 19:49:27 +09:00
Yusuke Wada
3f1de47f8f
chore(denoify): update buffer
2023-02-09 18:24:14 +09:00
Taku Amano
c169a413bd
feat: use added app's errorHandler with comose() ( #874 )
...
* refactor(compose): Swapped the order of onNotFound and onError in the compose() argument.
* feat: use added app's errorHandler
* chore: denoify
2023-02-09 18:13:27 +09:00
Yusuke Wada
9391278911
feat(router) [breaking]: StaticRouter obsolete ( #873 )
...
Co-authored-by: Taku Amano <taku@taaas.jp>
2023-02-09 16:58:28 +09:00
Taku Amano
dfd4f81e79
feat: Remove the StaticRouter from default candidates. ( #869 )
...
* feat: Remove the StaticRouter from default candidates.
* chore: denoify
2023-02-08 23:19:02 +09:00
Yusuke Wada
229228a7ba
Revert "feat: use added app's errorHandler ( #871 )" ( #872 )
...
This reverts commit b8a99b5367
.
2023-02-08 23:08:52 +09:00
Taku Amano
b8a99b5367
feat: use added app's errorHandler ( #871 )
...
Fix #851
* feat: use added app's errorHandler
* chore: denoify
* refactor(compose): Swapped the order of onNotFound and onError in the compose() argument.
* chore: denoify
2023-02-08 22:01:30 +09:00
Yusuke Wada
c0d2e608a6
feat: hc
- Hono Client ( #862 )
2023-02-08 07:22:32 +09:00
Taku Amano
d86728b4d1
perf(reg-exp-router): Cache Result<T> instead of T[] if there is no parameter. ( #867 )
...
* perf(reg-exp-router): Cache Result<T> instead of T[] if there is no parameter.
* chore: denoify
2023-02-08 06:47:19 +09:00
Yusuke Wada
2828e59a6c
Merge branch 'main' into next
2023-02-06 07:09:03 +09:00
Yusuke Wada
1a4c2fed78
chore: denoify ( #865 )
2023-02-06 07:01:51 +09:00
Yusuke Wada
41ba3a2193
Revert "perf(context): improve handling response ( #860 )"
...
This reverts commit ce0a8bd16d
.
2023-02-05 02:53:10 +09:00
Yusuke Wada
dd4122a5e0
refactor: obsolute CustomHandler
( #861 )
2023-02-03 05:56:59 +09:00
Yusuke Wada
ce0a8bd16d
perf(context): improve handling response ( #860 )
2023-02-02 08:08:07 +09:00
Yusuke Wada
a4800bf941
fix(req): never
if c.req.valid()
( #859 )
2023-02-02 08:06:19 +09:00
Yusuke Wada
aefe3869d0
chore: denoify
2023-02-02 00:25:58 +09:00
Yusuke Wada
fbf8959b74
fix(breaking): obsolete no args c.req.valid()
( #856 )
...
* v3.0.0-rc.9
* fix(breaking): obsolete no args `c.req.valid()`
* more strict
2023-02-01 22:02:09 +09:00
Yusuke Wada
e2b269acb0
feat: rewnew output types ( #853 )
...
* feat: rewnew output types
* denoify
* refactor: move type definitions of middlware handler to `types.ts`
* format comment block
* add more tests
2023-02-01 06:36:48 +09:00
Jayden
53de4a4021
Rename runtime keys ( #850 )
...
* Rename runtime keys
* denoify
* Fix test
2023-01-29 14:47:35 +09:00
Taku Amano
01b9fd4537
feat(reg-exp-router): Lookup static path by using Object ( #845 )
...
* feat(reg-exp-router): Search by key of Object if `path` has no variables.
* feat(reg-exp-router): Returns an empty RegExp if node is not added.
* feat(reg-exp-router): Check ambiguous path for static.
* chore: fix typo in test case
* chore: denoify
2023-01-29 13:55:27 +09:00
Yusuke Wada
0c76049487
Merge branch 'main' into next
2023-01-24 09:00:29 +09:00
Yusuke Wada
4f9d7f2d7e
fix(context): fixed bug raw Response
content-type is overwritten ( #836 )
2023-01-24 08:53:31 +09:00
Yusuke Wada
a53ae499d3
Merge branch 'main' into next
2023-01-23 08:40:17 +09:00
Yusuke Wada
033f23189c
fix(context): set the values of already set ( #834 )
2023-01-23 08:35:14 +09:00
Yusuke Wada
2afa06a5ba
feat(req): support c.req.valid('query')
( #832 )
2023-01-23 07:47:29 +09:00
Yusuke Wada
2de2ef3279
feat(validator): support multiple handlers w/ complex patterns. ( #831 )
2023-01-22 21:21:37 +09:00
Yusuke Wada
2ee0f739f5
fix(bun): fixed throwing the error in HTTPException
( #830 )
2023-01-22 15:06:55 +09:00
Yusuke Wada
698a783573
Merge branch 'main' into next
2023-01-22 14:28:13 +09:00
Yusuke Wada
e404319824
perf: use substring
and //.test
... ( #829 )
...
* v3.0.0-rc.8
* perf: use `substring` and `//.test` ...
2023-01-22 13:59:31 +09:00
Yusuke Wada
a60e46ae53
fix(request): make optional param type correct ( #826 )
...
* fix(request): make optional param type correct
* `ts-ignore`
* `denoify`
2023-01-22 13:32:33 +09:00
Yusuke Wada
fd4f18f6cc
chore: denoify
2023-01-19 22:45:25 +09:00
Yusuke Wada
49ffd51153
refactor(utils): remove minor mime types ( #816 )
2023-01-19 22:45:25 +09:00
Yusuke Wada
9958019d13
refactor: remove the json util not needed ( #815 )
2023-01-19 22:45:25 +09:00
Yusuke Wada
b6b1e5bc79
fix(context): enable destruction such json
( #813 )
...
This will fix #812
2023-01-19 22:45:25 +09:00
Yusuke Wada
eb6f1fdb0d
perf: optimize parsing queries and headers / 19% faster than 2.7.2 ( #811 )
2023-01-19 22:45:25 +09:00
Yusuke Wada
7beb64956c
feat: [BREAKING] introduce adapters ( #807 )
...
* feat: [BREAKING] introduce adapters
* added Next.js adapter
* denoify
2023-01-19 22:45:25 +09:00
Yusuke Wada
733f05c21c
refactor(types): more robust and flexible ( #806 )
...
* chore: denoify
* v3.0.0-rc.5
* refactor(types): more robust and flexible
* fixed some
2023-01-19 22:45:25 +09:00
Yusuke Wada
d00a47ef70
feat: introduce HTTPException
( #796 )
...
* feat: introduce `HTTPException`
* denoify and fixed tests for Lagon
2023-01-19 22:45:25 +09:00
Yusuke Wada
e989a93d01
refactor: tweak types ( #795 )
2023-01-19 22:45:25 +09:00
Yusuke Wada
d2dd42b35e
fix: fixed bugs handling TypeResponse
( #791 )
2023-01-19 22:45:25 +09:00
Taku Amano
9bc52a5ddd
feat(reg-exp-router): regexp support path including slashes. ( #789 )
...
* feat(reg-exp-router): `regexp` support path including slashes.
* chore: denoify
2023-01-19 22:45:25 +09:00
Yusuke Wada
b723faa81f
feat(trie-router): regexp
support path including slashes ( #768 )
...
* feat(trie-router): `regexp` support path including slashes
* refactor(trie-router): Use `splitRoutingPath`. (#781 )
* refactor(utils): splitRoutingPath, allow `@` to be safely used in parameter names. (#790 )
Co-authored-by: Taku Amano <taku@taaas.jp>
2023-01-19 22:45:25 +09:00
Yusuke Wada
548487aa53
chore: denoify
2023-01-19 22:45:25 +09:00
Yusuke Wada
a50efe4fa9
perf(context): tune up handling headers 3% faster ( #778 )
...
* perf(context): tune up handling headers ~ 3% faster
* uppercase
* denoify
2023-01-19 22:44:38 +09:00
Yusuke Wada
b49e557e5b
refactor(types): shorten name, make it safer ( #774 )
...
* refactor(types): shorten name, make it safer
* remove not used
2023-01-19 22:44:38 +09:00
Yusuke Wada
6bee574ca3
refactor(validator): show type error if get/head with form/json ( #772 )
2023-01-19 22:44:38 +09:00
Yusuke Wada
b567a574d6
refactor: form body should be Record<string, string | File>
( #771 )
...
* refactor: form body should be `Record<string, string | File>`
* refactored
2023-01-19 22:44:38 +09:00