index.js 294 B

123456789101112131415
  1. module.exports = isJSON;
  2. /**
  3. * Check if `body` should be interpreted as json.
  4. */
  5. function isJSON(body) {
  6. if (!body) return false;
  7. if ('string' == typeof body) return false;
  8. if ('function' == typeof body.pipe) return false;
  9. if (Buffer.isBuffer(body)) return false;
  10. return true;
  11. }