-
-
Notifications
You must be signed in to change notification settings - Fork 444
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
context.req.parseBody(): option for support dot notation #2656
Comments
Hi @vanodevium Are you talking about the "FormData"? If so, it's standard Web API, and it's not Hono matter. There is nothing we can do about it. |
It's something from the Browser API. For Hono, I think you can build a custom middleware for it. app.use(async (c, next) => {
const parsedBody = await c.req.parseBody();
// do the dot notation logic
c.req.bodyCache.parsedBody = parsedBody;
} catch (_err) {
} finally {
await next();
}
}); But becareful about modifying data in middleware, while modifying data in middleware is a common and often necessary practice in web development, it must be done responsibly, securely, and in compliance with legal and ethical standards. |
Ah, I see. I miss understanding. This is proposing adding a That is a good proposal. I'd like to know if others want this feature. |
I discussed this functionality with colleagues and programmer friends. The answer is the same for everyone - it is a very convenient and useful thing. Moreover, by default this thing will be turned off, so there will be no breaking changes for existing systems. Of course, the decision is yours. Thank you! |
I think it's something great to add :) |
Thanks to both. Let's add the feature. I'll do it, but now I'm busy working on other matters. Does anyone implement it? |
Fine, I will do it. I am thinking about the API cause |
Hi @MathurAditya724 actually I'm already building it, only unit tests left |
@fzn0x Great! Do let me know when the PR is ready, maybe I can add some pointers |
PR is ready! 👍 |
Hi @yusukebe I think we can close this issue :) |
Yes. Closing:) |
What is the feature you are proposing?
For now this method has only option all for array support. It is awesome!
In my opinion, it would be very convenient to add an option to support dot notation (dot: boolean), which would greatly simplify the processing of nested objects.
Example:
The text was updated successfully, but these errors were encountered: