@tpzdsp/next-toolkit 1.9.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tpzdsp/next-toolkit",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "description": "A reusable React component library for Next.js applications",
5
5
  "type": "module",
6
6
  "private": false,
@@ -8,7 +8,8 @@ export const MimeType = {
8
8
  Png: 'image/png',
9
9
  XJsonLines: 'application/x-jsonlines',
10
10
  Csv: 'text/csv',
11
- Form: 'application/x-www-form-urlencoded',
11
+ UrlEncodedForm: 'application/x-www-form-urlencoded',
12
+ MultipartForm: 'multipart/form-data',
12
13
  Text: 'text/plain',
13
14
  } as const;
14
15
 
package/src/http/proxy.ts CHANGED
@@ -89,7 +89,7 @@ const parseRequestBody = async (request: Request): Promise<unknown> => {
89
89
  case isJsonMimeType(contentType):
90
90
  return await request.json();
91
91
 
92
- case contentType === MimeType.Form: {
92
+ case contentType === MimeType.UrlEncodedForm: {
93
93
  const data = await request.formData();
94
94
 
95
95
  if (data.get(SPECIAL_FORM_DATA_TYPE) === SPECIAL_FORM_DOWNLOAD_POST) {
@@ -99,6 +99,12 @@ const parseRequestBody = async (request: Request): Promise<unknown> => {
99
99
  return Object.fromEntries(data.entries());
100
100
  }
101
101
 
102
+ case contentType?.startsWith(MimeType.MultipartForm): {
103
+ // For multipart/form-data, return the raw FormData object
104
+ // This preserves File objects and allows handlers to access them directly
105
+ return await request.formData();
106
+ }
107
+
102
108
  case isTextMimeType(contentType):
103
109
  return await request.text();
104
110