@parameter1/micro
Advanced tools
Comparing version 2.3.2 to 2.3.3
{ | ||
"name": "@parameter1/micro", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"type": "module", | ||
@@ -36,3 +36,3 @@ "description": "A wrapper for running JSON-based microservices.", | ||
}, | ||
"gitHead": "21805b741fbed33792a6021d263f13860a7aecb2" | ||
"gitHead": "f32ea07aa3ed54b294ad16840ae54e3469738699" | ||
} |
@@ -8,2 +8,10 @@ import micro from 'micro'; | ||
const parseTextBody = (body, parser) => { | ||
try { | ||
return parser(body); | ||
} catch (e) { | ||
throw createError(400, `Unable to parse body: ${e.message}`); | ||
} | ||
}; | ||
export default ({ | ||
@@ -32,3 +40,3 @@ name, | ||
const body = await text(req, { limit }); | ||
const input = parse(body); | ||
const input = parseTextBody(body, parse); | ||
const { action: path, params = {}, meta = {} } = input; | ||
@@ -35,0 +43,0 @@ if (!path) throw createError(400, 'No action provided.'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7120
177