Skip to content
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

Improve form support #144

Merged
merged 1 commit into from
Mar 24, 2024
Merged

Improve form support #144

merged 1 commit into from
Mar 24, 2024

Conversation

blomqma
Copy link
Owner

@blomqma blomqma commented Mar 18, 2024

This adds support for strongly-typed
form data using the zod-form-data
schema that are now supported alongside
regular Zod schemas.

Pages router router routes now support
validating and strongly typing form data
requests that have the application/x-www-form-urlencoded,
whereas app router routes also support strongly typed
multipart/form-data requests using the req.formData()
method from the NextRequest object.

Because RPC routes share the common rpcOperation
method for both pages and app router, strongly typed form
data is for now only supported with the application/x-www-form-urlencoded
content type.

Copy link

vercel bot commented Mar 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-rest-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 24, 2024 1:22pm
next-rest-framework-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 24, 2024 1:22pm

@blomqma blomqma force-pushed the form-improvements branch from ce4b943 to e176f03 Compare March 18, 2024 00:08
@blomqma blomqma force-pushed the form-improvements branch from e176f03 to fab30cb Compare March 18, 2024 00:10
@blomqma blomqma force-pushed the form-improvements branch from fab30cb to b0f616c Compare March 18, 2024 18:47
@blomqma blomqma force-pushed the form-improvements branch from b0f616c to 7b886ca Compare March 18, 2024 19:17
@blomqma blomqma changed the title Improve form support WIP Improve form support Mar 18, 2024
@blomqma blomqma marked this pull request as ready for review March 18, 2024 19:17
@blomqma blomqma force-pushed the form-improvements branch from 7b886ca to 02dfee1 Compare March 18, 2024 19:18
@blomqma blomqma force-pushed the form-improvements branch from 02dfee1 to c454794 Compare March 18, 2024 19:22
@blomqma blomqma force-pushed the form-improvements branch from c454794 to 9c0dc41 Compare March 18, 2024 19:40
@blomqma blomqma marked this pull request as draft March 19, 2024 00:57
@blomqma blomqma force-pushed the form-improvements branch from e935e70 to 228e13a Compare March 21, 2024 22:23
This adds support for strongly-typed
form data using the `zod-form-data`
schema that are now supported alongside
regular Zod schemas.

Pages router router routes now support
validating and strongly typing form data
requests that have the `application/x-www-form-urlencoded`,
whereas app router routes also support strongly typed
`multipart/form-data` requests using the `req.formData()`
method from the NextRequest object.

Because RPC routes share the common `rpcOperation`
method for both pages and app router, strongly typed form
data is for now only supported with the `application/x-www-form-urlencoded`
content type. (+1 squashed commit)
Squashed commits:
[5e4cf8d] Improve form support

This adds support for strongly-typed
form data using the `zod-form-data`
schema that are now supported alongside
regular Zod schemas.

Pages router router routes now support
validating and strongly typing form data
requests that have the `application/x-www-form-urlencoded`,
whereas app router routes also support strongly typed
`multipart/form-data` requests using the `req.formData()`
method from the NextRequest object.

Because RPC routes share the common `rpcOperation`
method for both pages and app router, strongly typed form
data is for now only supported with the `application/x-www-form-urlencoded`
content type.
@blomqma blomqma force-pushed the form-improvements branch from 66d59d6 to 492fce4 Compare March 24, 2024 13:20
@blomqma blomqma marked this pull request as ready for review March 24, 2024 13:24
@blomqma blomqma merged commit 007a72e into main Mar 24, 2024
7 checks passed
@blomqma blomqma deleted the form-improvements branch March 24, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant