0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-30 01:56:18 +01:00
Commit Graph

49 Commits

Author SHA1 Message Date
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
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
d06a3123e7 Merge branch 'main' into next 2023-05-02 16:30:24 +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
0a19deaa5b
perf: shorten code (#1051) 2023-04-30 21:07:00 +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
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
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
d4e3728881 chore: denoify 2023-02-16 18:08:50 +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
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
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
Yusuke Wada
2afa06a5ba
feat(req): support c.req.valid('query') (#832) 2023-01-23 07:47:29 +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
eb6f1fdb0d perf: optimize parsing queries and headers / 19% faster than 2.7.2 (#811) 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
e989a93d01 refactor: tweak types (#795) 2023-01-19 22:45:25 +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
Yusuke Wada
397c12e181 refactor: refactor and fix Types (#748)
* wip

* refactor: refactor and fix Types
2023-01-19 22:44:34 +09:00
Yusuke Wada
85e3c6a275 feat: new validator middleware using 3rd-party & current middleware obsolete (#745)
* feat: introduce HonoRequest with "wrapper pattern" (#733)

* feat: HonoRequest

* avoid `awaits`

* use `raw` instead of `original`

* feat: types for "RPC" support & build-in validator obsolete

* feat: introduce HonoRequest with "wrapper pattern" (#733)

* feat: HonoRequest

* avoid `awaits`

* use `raw` instead of `original`

* create generic middleare for 3rd-party validator

* indent

* support multiple validators and refactor

* remove unsed lines

* denoify
2023-01-19 22:40:13 +09:00
Yusuke Wada
a6d54dbff3 feat: introduce HonoRequest with "wrapper pattern" (#733)
* feat: HonoRequest

* avoid `awaits`

* use `raw` instead of `original`
2023-01-19 22:40:13 +09:00
Yusuke Wada
d755ed50b5
fix(request): req.param() should return undefined not "undefined" (#721) 2022-12-14 01:07:07 +09:00
Yusuke Wada
59bb0b1a40
feat(handler): "schema" allow normal types (#700)
* feat(handler): "schema" allow normal types

* check types for handler+validator+handler pattern

* denoify

* improve type definitions
2022-12-10 16:37:14 +09:00
unworthyEnzyme
34231435a6
fix: cookie should return string | undefined (#709)
* `cookie` should return `string | undefined`

* update the tests
2022-12-10 01:09:18 +09:00
Jayden
760ae30251
Fix detecting node runtime (#696)
* Fix

* Denoify

* Avoid error in other runtime

* chore: remove unnecessary config testPathIgnorePatterns (#697)

* Fix vercel

Co-authored-by: Horie Issei <issei.horie@is2ei.com>
2022-12-02 11:28:49 +09:00
Yusuke Wada
1eb49b8d96
refactor: support new @cloudflare/worker-types (#673)
* refactor: support new `@cloudflare/worker-types`

* do not attach crypto to global

* denoify ignore serve-static for cloudlfare

* ignore the utility for cloudflare

* import types
2022-11-23 07:27:42 +09:00
Jayden
06cecbd1e2
fix(param): Decode context.param (#662)
* Decode url param

* Denoify
2022-11-14 09:10:03 +09:00
Yusuke Wada
8e9b1c8099
fix(type): make compatibility with @cloudflare/workers-types (#645) 2022-11-03 15:39:25 +09:00
Yusuke Wada
8627010094
refactor(types): refactor and add tests for checking Types (#615)
* refactor(types): refactor and add tests for checking Types

* remove unused

* uncomment

* use `Handler` in validator middleware

* remove unused

* create `src/validator` dir and move some files into it

* add the case that the context is in `validator`

* rename `D` to `S`
2022-10-23 08:10:00 +09:00
Taku Amano
957a5a9ac9
feat(validator): Enable verification results to be retrieved as structured data. (#547)
* feat(validator): Enable verification results to be retrieved as structured data.

* chore: denoify
2022-09-21 09:40:17 +09:00
Yusuke Wada
976b2c310e
feat: c.req.body and c.req.json accept generics (#529) 2022-09-20 22:01:03 +09:00
Yusuke Wada
a2cc1a01c2
feat: another idea of Validator Middleware (#535)
* feat: Another idea of validator middleware

* denoify

* set property value in constructor

* rename `option` to `options`

* add test for handling type error

* use `test` instead of `match`
2022-09-20 10:11:34 +09:00
Yusuke Wada
46c6a8de5e
feat(middleware): introduce "built-in" Validator Middleware (#505)
* feat(middleware): introduce built-in Validator Middleware

* fixed type of `req.json()`

* Feat/builtin validator middleware another idea (#508)

* Enable overwriting of query/header data.

* Returns only verified data.

* rename `index.test.ts` to `middleware.test.ts`

* add `removeAdditional` option

* handling error that the JSON body is null

* tidy

* check is it string or not

* implement `isIn`

* enable validation the valies are duplicate

Co-authored-by: Taku Amano <taku@taaas.jp>
2022-09-13 07:54:06 +09:00
Yusuke Wada
b6954815cb
perf(req): improve c.req.query performance (#498)
* perf(req): improve `c.req.query` performance

* allow fragments as query strings
2022-09-05 19:08:10 +09:00
Yusuke Wada
128a59aec2
fix: make that c.req.parseBody parses only FormData (#487) 2022-08-27 11:38:48 +09:00
Yusuke Wada
c7ee2e7603
fix: enable passing Generics to c.req.parseBody, default is any (#481) 2022-08-25 09:25:11 +09:00
Yusuke Wada
9f2a270c28
refactor(utils/html): rename Buffer to StringBuffer (#449) 2022-08-03 11:24:51 +09:00
Yusuke Wada
16adde746b refactor: denoify 2022-07-15 08:40:15 +09:00
Yusuke Wada
9a41cde632 chore: denoify 2022-07-15 08:40:15 +09:00
Yusuke Wada
d9e9e62e47
feat: support Deno! (#336) 2022-07-02 15:09:45 +09:00