-
-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add new shortcuts for request/response #62
Conversation
src/middleware/default.ts
Outdated
@@ -6,6 +6,10 @@ export const defaultMiddleware = async (c: Context, next: Function) => { | |||
const url = new URL(c.req.url) | |||
return url.searchParams.get(key) | |||
} | |||
c.req.params = c.req.param // alias |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we just make ctx.req.params
at the first place to avoid this alias?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, that is better to make the alias after this: https://github.com/yusukebe/hono/pull/62/files#diff-fef0c99deaa99c63dde9a9af2451ae5281a68e92c338218d644a08b358878245R131
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we have both params
and param
in a Request
, is possible to make it only params
or param
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we make it param
only because params
is just for backward compatibility and that we have both may cause confusion.
* Add new shortcuts for request/response * We have only `param`, we can not use `params` * Update readme * tweak
Add new shortcuts for Requests:
Add new shortcuts for Response: