0
0
mirror of https://github.com/honojs/hono.git synced 2024-12-01 10:51:01 +00:00
Commit Graph

1375 Commits

Author SHA1 Message Date
Yusuke Wada
8ba721e654 v3.7.6 2023-10-12 18:13:34 +09:00
Yusuke Wada
2f9a07dda9
perf(hono-base): use instanceOf (#1565)
* perf(hono-base): use `instanceOf`

* denoify
2023-10-12 17:48:36 +09:00
Bruno Marques
cca7577cf4
fix: return status 500 when using validator 'form' (#1554)
* fix: return status 500 when using validator 'form'

When using `validator('form', ...)` hono is returning a 500 status
when receiving a POST request with a JSON in request body, instead
of a bad request 400, .

This is happenning due to a unhandled error in an
underlying library (@miniflare).
https://github.com/cloudflare/miniflare/pull/711

The code changes in this PR are responsible to prepare the code to
handle possible TypeError that can be thrown in the future, by the lib
doing the FormData parsing, as per, https://fetch.spec.whatwg.org/#dom-body-formdata.

This PR should wait for bugfix on @miniflare.

* fix: json validator allowing Content-Type value other than json/application

Forgery attacks will try to avoid preflight requests when POSTing JSON
payloads manipulating the HTTP header Content-Type. For example, it will
send a JSON payload with `Content-Type=text/plain`, but the request stills
containing a JSON in its body. Those requests must be rejected.

Thus, when using the validator with the target set to `json`, we must
check the Content-Type header.

* fix: change check for json Content-Type header

Change JSON validation to only allow Content-Type header starting with
'application/json'.

Change from regexp test to starsWith builtin function, to make code more
expressive.

---------

Co-authored-by: Bruno Nascimento <bruno.nascimento@csghq.com>
2023-10-12 00:21:01 +09:00
Yusuke Wada
90259f3acb
test: use Node.js Native Web APIs instead of miniflare's (#1558)
* test: use Node.js Native Web APIs instead of miniflare's

* `denoify-ignore`
2023-10-10 21:32:10 +09:00
Taku Amano
0e77991429
feat(reg-exp-router): Improve capture group support. (#1556)
* feat(reg-exp-router): Improve capture group support.

* chore: denoify
2023-10-10 07:49:59 +09:00
Yusuke Wada
3d3f7cdf87 v3.8.0-rc.2 2023-10-06 08:43:32 +09:00
Yusuke Wada
2feb300578 Merge branch 'main' into next 2023-10-06 05:17:45 +09:00
Yusuke Wada
3e4f151fa9 v3.7.5 2023-10-06 05:16:02 +09:00
Yusuke Wada
c703dd3726
fix(types): don't use webworker types (#1548)
* fix(types): don't use webworker types

* denoify
2023-10-06 05:14:16 +09:00
Yusuke Wada
48c9fed011 v3.8.0-rc.1 2023-10-05 18:12:50 +09:00
Taku Amano
b05ed376b2
feat(jsx): Introduce Context API and jsx-renderer middleware (#1496)
Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
2023-10-05 16:57:33 +09:00
Arunava Basu
8aea6e5a42
feat: rename middleware to createMiddleware (#1540)
* feat: rename middleware to createMiddleware and mdoify tests

* feat:yarn denoify

* feat:formatted

* feat:cleanup

* feat:cleanup

* feat: denoify
2023-10-05 16:40:38 +09:00
Sor4chi
e4f7f971a8
feat: parseBody() for multi values' field (#1528)
* feat: add "all" option to parseBody

* feat: add parseBody option to `req.parseBody()`

* test: add single value (override) and multiple value cases to praseBody

* test: split parse case of parseBody

* chore: denoify

* refactor(body): make clear parseBody logic

* chore: denoify

* fix: single value of the field should not be parsed to array

* test: add some case of single value's field in "all" option

* chore: denoify
2023-10-05 16:33:56 +09:00
watany
96476a787b
feat(helper): streaming-sse (#1504)
* feat(helper): streaming-sse

* lint-check

* fixed streaming

* few fixed.

* denoify
2023-10-05 16:33:34 +09:00
Yusuke Wada
db3c1a75e8 v3.7.4 2023-10-05 06:09:28 +09:00
Yusuke Wada
3844b41dd4
fix(vercel): pass request context (#1543) 2023-10-05 00:53:57 +09:00
Yusuke Wada
6a9590d69c
fix(jsx): render a child or odd children with Fragment correctly (#1541)
* fix(jsx): render a child or odd children with `Fragment` correctly

* denoify
2023-10-05 00:18:18 +09:00
Yusuke Wada
93fec337d0
refactor(hono-base): remove any casting (#1535)
* refactor(hono-base): remove `any` casting

* denoify
2023-10-03 23:19:05 +09:00
Yusuke Wada
e326208fdf
fix(context): use FetchEvent instead of FetchEventLike (#1532) 2023-10-03 23:09:16 +09:00
Yusuke Wada
82f103302b v3.7.3 2023-09-30 22:04:36 +09:00
watany
43749a0efd
feat(adaptor): Accessable Lambda "Context" (#1523)
* adding lambda-context

* format

* type any

* ignore denoify

* export type
2023-09-30 21:55:35 +09:00
Yusuke Wada
dddd4978d8
fix(types): fix inferring path strings for an optional parameter with regexp (#1522)
* fix(types): fix inferring path strings for optional parameters with regexp

* denoify

* fix the test
2023-09-29 06:49:52 +09:00
Yusuke Wada
731957aea2 v3.7.2 2023-09-23 23:47:34 +09:00
Yusuke Wada
c7fc8a033a
fix(utils/buffer): fix bufferToFormData() (#1500)
* fix(utils/buffer): fix `bufferToFormData()`

* denoify
2023-09-23 23:46:09 +09:00
Yusuke Wada
cefa08bf58 v3.7.1 2023-09-22 07:28:41 +09:00
Yusuke Wada
a18828886f
fix(deno): export testing helper (#1493) 2023-09-22 06:30:25 +09:00
Yusuke Wada
93f629b560 v3.7.0 2023-09-21 11:49:12 +09:00
Yusuke Wada
3eb52bc102
Merge pull request #1489 from honojs/next 2023-09-21 11:44:56 +09:00
Nico Plyley
d6478aac6c
fix(jwt): incorrect error message (#1487) 2023-09-21 06:14:48 +09:00
Yusuke Wada
6c374623ed Merge branch 'main' into next 2023-09-21 00:32:01 +09:00
Yusuke Wada
2c47bf5890
fix(context): fix c.stream() and c.streamText() matters (#1482)
* fix(context): fix `c.stream()` and `c.streamText()`

* denoify

* remove the not used line
2023-09-20 22:53:30 +09:00
Yusuke Wada
11f2fe53ad
fix(jwt): avoid using enum (#1485)
* fix(jwt): avoid using `enum`

* denoify
2023-09-20 22:48:14 +09:00
hagishi
cdb36b80af
feat(client) add cookie type validate (#1476)
* feat: add hc header type check

* fix: revert comment

* denoify

* feat(client): add cookie type valid

* denoify

* feat: remove function from cookie helper

* refactor: modify client type
2023-09-19 07:25:34 +09:00
uaichat
94786a7e31
fix: error to retrieve cookie (#1386)
* fix: error to retrieve cookie

TypeError: Cannot read properties of undefined (reading 'split')

* add a test and denoify

---------

Co-authored-by: Yusuke Wada <yusuke@cloudflare.com>
2023-09-19 07:23:15 +09:00
BenMix
c865b50a77
feat: add devcontainer to improve developer experience (#1100)
* feat: add devcontainer to improve developer experience

* Update .devcontainer/Dockerfile

Co-authored-by: CyberFlame <cyberflameu@gmail.com>

---------

Co-authored-by: CyberFlame <cyberflameu@gmail.com>
2023-09-19 06:47:24 +09:00
Yusuke Wada
5970f64407 v3.7.0-rc.1 2023-09-17 09:11:28 +09:00
Yusuke Wada
d2b3a05741
chore(benchmark): add memoirist router (#1474) 2023-09-17 09:08:59 +09:00
hagishi
2e5e1b2f0c
feat: add Hono test client (RPC) (#1451)
* feat: add test client helper

* refactor:  rename from hc to testClient
2023-09-17 09:04:07 +09:00
neucoas
8d4f23a1ea
feat: expose the Jwt fucntions under the 'hono/jwt' path (#1472)
* Expose the Jwt fucntions under the 'hono/jwt' path

* Run yarn denoify
2023-09-17 07:22:39 +09:00
hagishi
a5ba936784
feat: Refactor ClientRequest Type for header validation (#1462)
* feat: add hc header type check

* fix: revert comment

* denoify
2023-09-17 01:09:47 +09:00
Bakunya | Kirisaki Rem
f25ae8aa5c
feat: Improvement of Parse Body (#1461)
* feat: improvement of parse body

* feat: add test for improvement of parse body commit

* chore: denoify and fix:format

* rm: test file on deno_dist

---------

Co-authored-by: irvan hakim <irvanhakim.dev@gmail.com>
2023-09-17 01:09:25 +09:00
CyberFlame
d64cbdb05a feat: Add CHIP support - supersedes #1198 (#1456)
Signed-off-by: CyberFlame <cyberflameu@gmail.com>
Co-authored-by: David Manouchehri <david.manouchehri@ai.moda>
2023-09-17 00:57:26 +09:00
Sor4chi
31f0605209 feat: Add c.stream() (#1437)
* feat: implement stream api utility-class

* test: write the test of StreamApi

* feat: implement `c.stream` to context

* test: write the test of `c.stream()`

* chore: denoify

* fix: extend for bytes, remove buffer system, add pipe and log interface

* test: update test about log, pipe, etc... for streaming API

* feat: extend textStream interface, remove utf-8 content-type

* test: add test about `c.textStream`

* refactor: update some args name

* chore: denoify

* fix: for deno, removed the optional parameter of `write` and `writeln`

* chore: denoify

* feat: add charset for textStream content-type header

* fix: rename textStream to streamText

* fix: reuse stream in streamText for bundle size

* feat: add `stream.wait()` api

* chore: denoify

* fix: rename `stream.wait` to `stream.sleep`

* test: use `stream.sleep` for waiting

* refactor: remove `stream.log`

* fix: remove preHeader from `c.stream()` and use `transfer-encoding` only `c.streamText()`

* chore: denoify

* refactoring: remove preHeader initialize

* test: reduce sleep duration

* chore: denoify

Co-authored-by: Glen Maddern <glenmaddern@gmail.com>
2023-09-17 00:57:26 +09:00
Yusuke Wada
96de2da8f9 v3.6.3 2023-09-16 23:13:15 +09:00
Yusuke Wada
b450751403
fix(types): support infering path types for multiple handlers (#1473)
* fix(types): support infering path types for multiple handlers

* denoify
2023-09-16 22:47:47 +09:00
Yusuke Wada
aa65a6e1b9
fix(types): return types of jsonT() should be union (#1471)
* fix(types): return types of `jsonT()` should be union

* denoify
2023-09-16 22:09:46 +09:00
Yusuke Wada
acbd961624 v3.6.2 2023-09-16 21:22:41 +09:00
Yusuke Wada
0febdf7544
fix(type): check 1st arg of middleware is string (#1470)
* fix(type): check 1st arg of middleware is `string`

* denoify
2023-09-16 21:05:31 +09:00
Yusuke Wada
bb386a49c9
fix(types): middleware with different env types (#1466)
* fix(types): middleware with different env types

* denoify

* fix factory helper
2023-09-16 20:32:54 +09:00
Rivaldi Putra
e4feba7830
test(types): Use ExpectTypeOf from vitest to test types (#1458)
Fix #1429
2023-09-15 18:53:58 +09:00