Comparing version 6.0.12 to 6.1.0
{ | ||
"name": "bent", | ||
"version": "6.0.12", | ||
"version": "6.1.0", | ||
"description": "Functional HTTP client for Node.js w/ async/await.", | ||
@@ -5,0 +5,0 @@ "main": "src/nodejs.js", |
@@ -87,12 +87,19 @@ 'use strict' | ||
} | ||
if (Buffer.isBuffer(body) || typeof body === 'string') { | ||
req.end(body) | ||
if (Buffer.isBuffer(body)) { | ||
// noop | ||
} else if (typeof body === 'string') { | ||
body = Buffer.from(body) | ||
} else if (isStream(body)) { | ||
body.pipe(req) | ||
body = null | ||
} else if (typeof body === 'object') { | ||
req.setHeader('content-type', 'application/json') | ||
req.end(JSON.stringify(body)) | ||
body = Buffer.from(JSON.stringify(body)) | ||
} else { | ||
reject(new Error('Unknown body type.')) | ||
} | ||
if (body) { | ||
req.setHeader('content-length', body.length) | ||
req.end(body) | ||
} | ||
} else { | ||
@@ -99,0 +106,0 @@ req.end() |
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
15625
387