@parameter1/micro
Advanced tools
Comparing version 2.3.1 to 2.3.2
{ | ||
"name": "@parameter1/micro", | ||
"version": "2.3.1", | ||
"version": "2.3.2", | ||
"type": "module", | ||
@@ -36,3 +36,3 @@ "description": "A wrapper for running JSON-based microservices.", | ||
}, | ||
"gitHead": "841391bb5d6feb967be2e33f06cd4d9bb5411a1a" | ||
"gitHead": "21805b741fbed33792a6021d263f13860a7aecb2" | ||
} |
@@ -6,3 +6,8 @@ import fetch from 'node-fetch'; | ||
export default ({ url, headers: globalHeaders, stringify = JSON.stringify } = {}) => { | ||
export default ({ | ||
url, | ||
headers: globalHeaders, | ||
parse = JSON.parse, | ||
stringify = JSON.stringify, | ||
} = {}) => { | ||
if (!url) throw createError(500, 'No service URL was provided.'); | ||
@@ -30,7 +35,8 @@ | ||
}); | ||
const json = await res.json(); | ||
if (!res.ok) throw createError(res.status, json.message); | ||
return json.data; | ||
const text = await res.text(); | ||
const parsed = parse(text); | ||
if (!res.ok) throw createError(res.status, parsed.message); | ||
return parsed.data; | ||
}, | ||
}); | ||
}; |
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
6940
170