Comparing version 3.5.2 to 3.5.3
@@ -61,10 +61,6 @@ const breq = require('bluereq') | ||
const debugFn = debug ? DebugFn(method, params) : noop | ||
return breq[verb](params) | ||
.tap(res => { | ||
if (debug) { | ||
// Stringify the body to make it copy-pastable for curl | ||
const bodyStr = body != null ? (JSON.stringify(body) + ' ') : '' | ||
console.log(`[blue-cot] ${method} ${params.url} ${bodyStr}- ${res.statusCode} - ${res.elapsedTime} ms`) | ||
} | ||
}) | ||
.tap(debugFn) | ||
.catch(err => { | ||
@@ -76,2 +72,3 @@ if (err.statusCode !== 401) throw err | ||
return breq[verb](params) | ||
.tap(debugFn) | ||
}) | ||
@@ -82,2 +79,11 @@ }) | ||
const DebugFn = (method, params) => res => { | ||
const { body } = params | ||
// Stringify the body to make it copy-pastable for curl | ||
const bodyStr = body != null ? (JSON.stringify(body) + ' ') : '' | ||
console.log(`[blue-cot] ${method} ${params.url} ${bodyStr}- ${res.statusCode} - ${res.elapsedTime} ms`) | ||
} | ||
const noop = () => {} | ||
module.exports = function (opts) { | ||
@@ -84,0 +90,0 @@ const jsonRequest = JsonRequest(configParser(opts)) |
@@ -18,3 +18,3 @@ { | ||
}, | ||
"version": "3.5.2", | ||
"version": "3.5.3", | ||
"main": "lib/cot.js", | ||
@@ -21,0 +21,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
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
1083
89697