handle fs read streams

This commit is contained in:
Randall Schmidt
2020-11-28 11:25:23 -05:00
parent 8a338f5f5d
commit 3b5adecd7f
2 changed files with 28 additions and 2 deletions

View File

@ -11,13 +11,17 @@ function md5(str) {
}
function getBodyCacheKeyJson(body) {
if (typeof body === 'string') {
if (!body) {
return body;
} if (typeof body === 'string') {
return body;
} if (body instanceof URLSearchParams) {
return body.toString();
} if (body instanceof fs.ReadStream) {
return body.path;
}
return body;
throw new Error('Unsupported body type');
}
function getCacheKey(requestArguments) {