Skip to content

getPayload helper #785

@danielkellyio

Description

@danielkellyio

Describe the feature

Would be nice I think if h3 had a helper function like getPayload

Would work just like getQuery and readBody but would work for both depending on the request method and also include the route params

Here is a proof of concept for getPayload as a utility function:
https://stackblitz.com/edit/github-dbe8gu?file=server%2Futils%2Findex.ts

(uses Nuxt getRouterParams... not sure what that would be in h3)

Would also be great to have a getValidatedPayload version that works like the query and body counterparts.

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions