form-data-middleware@0.2.0
Breaking Changes📦 remixView on GitHub →
⚠ 1 breaking✨ 1 features🐛 1 fixes🔧 5 symbols
Summary
This release introduces a breaking change to how form data is stored in request context, moving it to use the generic context API via `FormData`. It also ensures idempotent parsing of form data.
⚠️ Breaking Changes
- Form data middleware no longer reads/writes `context.formData` or `context.files`. Parsed `FormData` is now stored on request context using `context.set(FormData, formData)` and must be read using `context.get(FormData)`.
Migration Steps
- Update code that accessed form data via `context.formData` or `context.files` to use `context.get(FormData)` instead.
✨ New Features
- `formData()` now contributes `FormData` to `fetch-router`'s typed request context, allowing apps deriving context from middleware to read `context.get(FormData)` without manual type assertions.
🐛 Bug Fixes
- `formData()` is now a no-op if `FormData` has already been parsed earlier in the request pipeline, preventing re-reading or re-parsing the request body when the middleware is registered multiple times.