diff options
Diffstat (limited to 'node_modules/koa-is-json/index.js')
| -rw-r--r-- | node_modules/koa-is-json/index.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/node_modules/koa-is-json/index.js b/node_modules/koa-is-json/index.js new file mode 100644 index 00000000..40ca7694 --- /dev/null +++ b/node_modules/koa-is-json/index.js @@ -0,0 +1,14 @@ + +module.exports = isJSON; + +/** + * Check if `body` should be interpreted as json. + */ + +function isJSON(body) { + if (!body) return false; + if ('string' == typeof body) return false; + if ('function' == typeof body.pipe) return false; + if (Buffer.isBuffer(body)) return false; + return true; +} |
