@parameter1/micro
Advanced tools
Comparing version 2.3.0 to 2.3.1
{ | ||
"name": "@parameter1/micro", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"type": "module", | ||
@@ -36,3 +36,3 @@ "description": "A wrapper for running JSON-based microservices.", | ||
}, | ||
"gitHead": "87d26496a5b7a429f2a83ed0df544f5221c13099" | ||
"gitHead": "841391bb5d6feb967be2e33f06cd4d9bb5411a1a" | ||
} |
@@ -26,2 +26,3 @@ import micro from 'micro'; | ||
logErrors = true, | ||
stringify = JSON.stringify, | ||
}) => async (req, res) => { | ||
@@ -35,3 +36,3 @@ try { | ||
const obj = buildResponse({ name, error: e, status }); | ||
send(res, status, obj); | ||
send(res, status, stringify(obj)); | ||
if (e instanceof Error) { | ||
@@ -38,0 +39,0 @@ if (logErrors === true) log(`${status} ${stack}`); |
@@ -22,2 +22,3 @@ import micro from 'micro'; | ||
parse = JSON.parse, | ||
stringify = JSON.stringify, | ||
} = {}) => { | ||
@@ -29,2 +30,3 @@ if (!name) throw new Error('No service name was provided.'); | ||
const actionHandler = async (req, res) => { | ||
res.setHeader('Content-Type', 'application/json; charset=utf-8'); | ||
const body = await text(req, { limit }); | ||
@@ -49,3 +51,3 @@ const input = parse(body); | ||
if (isFn(onActionEnd)) await onActionEnd(contextData); | ||
return { data }; | ||
return stringify({ data }); | ||
}; | ||
@@ -62,3 +64,4 @@ | ||
logErrors, | ||
stringify, | ||
})); | ||
}; |
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
6873
164