@@ -52,4 +52,4 @@ "use strict"; | ||
const contentType = request.headers.get('content-type') || 'text/plain'; | ||
// url-encoded | ||
if (contentType === 'application/x-www-form-urlencoded') { | ||
// url-encoded or multipart/form-data | ||
if (contentType === 'application/x-www-form-urlencoded' || contentType.startsWith('multipart/form-data;')) { | ||
const formData = await request.formData(); | ||
@@ -56,0 +56,0 @@ const formDataVal = formData.get('csrf_token'); |
@@ -46,4 +46,4 @@ /** | ||
const contentType = request.headers.get('content-type') || 'text/plain'; | ||
// url-encoded | ||
if (contentType === 'application/x-www-form-urlencoded') { | ||
// url-encoded or multipart/form-data | ||
if (contentType === 'application/x-www-form-urlencoded' || contentType.startsWith('multipart/form-data;')) { | ||
const formData = await request.formData(); | ||
@@ -50,0 +50,0 @@ const formDataVal = formData.get('csrf_token'); |
{ | ||
"name": "edge-csrf", | ||
"description": "CSRF protection for Next.js middleware", | ||
"version": "1.0.4", | ||
"version": "1.0.5-rc1", | ||
"author": "Andres Morey", | ||
@@ -14,8 +14,2 @@ "license": "MIT", | ||
], | ||
"scripts": { | ||
"bench": "node --experimental-specifier-resolution=node", | ||
"build": "rm -rf dist && tsc && tsc --build tsconfig.cjs.json", | ||
"lint": "eslint", | ||
"test": "jest --env @edge-runtime/jest-environment" | ||
}, | ||
"devDependencies": { | ||
@@ -27,2 +21,3 @@ "@babel/core": "^7.20.5", | ||
"@edge-runtime/primitives": "^2.0.2", | ||
"@jest/types": "^29.6.3", | ||
"@types/jest": "^29.2.4", | ||
@@ -52,3 +47,9 @@ "@types/node": "^18.11.15", | ||
"next" | ||
] | ||
} | ||
], | ||
"scripts": { | ||
"bench": "node --experimental-specifier-resolution=node", | ||
"build": "rm -rf dist && tsc && tsc --build tsconfig.cjs.json", | ||
"lint": "eslint", | ||
"test": "jest --env @edge-runtime/jest-environment" | ||
} | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
27894
0.65%20
5.26%2
100%