heroku-client
Advanced tools
Comparing version 3.0.0-beta3 to 3.0.0
'use strict' | ||
const debug = require('debug')('http') | ||
const debugHeaders = require('debug')('http:headers') | ||
/* | ||
@@ -125,5 +128,5 @@ * Object capable of making API calls. | ||
concat(res).then((data) => { | ||
if (this.debug) { | ||
console.error('<-- ' + data) | ||
} | ||
debug(`<-- ${this.options.method} ${this.options.path}\n${data}`) | ||
debugHeaders('\n' + renderHeaders(res.headers)) | ||
if (this.debug) console.error('<-- ' + data) | ||
if (res.statusCode.toString().match(/^2\d{2}$/)) { | ||
@@ -134,3 +137,3 @@ this.handleSuccess(res, data) | ||
} | ||
}) | ||
}).catch(this.reject) | ||
}) | ||
@@ -155,8 +158,7 @@ } | ||
logRequest (req) { | ||
if (this.debug) { | ||
console.error('--> ' + req.method + ' ' + req.path) | ||
} | ||
if (this.debugHeaders) { | ||
printHeaders(req._headers) | ||
} | ||
let headers = renderHeaders(req._headers) | ||
debug(`--> ${req.method} ${this.options.path}`) | ||
debugHeaders('\n' + headers) | ||
if (this.debug) console.error('--> ' + req.method + ' ' + req.path) | ||
if (this.debugHeaders) console.error(headers) | ||
} | ||
@@ -175,8 +177,5 @@ | ||
} | ||
if (this.debug) { | ||
console.error('<-- ' + res.statusCode + ' ' + res.statusMessage) | ||
} | ||
if (this.debugHeaders) { | ||
printHeaders(res.headers) | ||
} | ||
let headers = renderHeaders(res.headers) | ||
if (this.debug) console.error('<-- ' + res.statusCode + ' ' + res.statusMessage) | ||
if (this.debugHeaders) console.error(headers) | ||
} | ||
@@ -328,11 +327,7 @@ | ||
function printHeaders (headers) { | ||
var key | ||
var value | ||
for (key in headers) { | ||
if (headers.hasOwnProperty(key)) { | ||
value = key.toUpperCase() === 'AUTHORIZATION' ? 'REDACTED' : headers[key] | ||
console.error(' ' + key + '=' + value) | ||
} | ||
} | ||
function renderHeaders (headers) { | ||
return Object.keys(headers).map(key => { | ||
let value = key.toUpperCase() === 'AUTHORIZATION' ? 'REDACTED' : headers[key] | ||
return ' ' + key + '=' + value | ||
}).join('\n') | ||
} | ||
@@ -339,0 +334,0 @@ |
{ | ||
"name": "heroku-client", | ||
"description": "A wrapper for the Heroku v3 API", | ||
"version": "3.0.0-beta3", | ||
"version": "3.0.0", | ||
"author": "Jeff Dickey", | ||
@@ -17,2 +17,3 @@ "bugs": { | ||
"dependencies": { | ||
"debug": "^2.2.0", | ||
"is-retry-allowed": "^1.0.0", | ||
@@ -22,7 +23,7 @@ "tunnel-agent": "^0.4.0" | ||
"devDependencies": { | ||
"ava": "0.14.0", | ||
"codecov": "1.0.1", | ||
"nock": "8.0.0", | ||
"nyc": "6.4.4", | ||
"standard": "7.1.0" | ||
"ava": "^0.16.0", | ||
"codecov": "^1.0.1", | ||
"nock": "^8.0.0", | ||
"nyc": "^7.0.0", | ||
"standard": "^7.1.0" | ||
}, | ||
@@ -29,0 +30,0 @@ "engines": { |
@@ -10,3 +10,2 @@ # heroku-client | ||
- [Install](#install) | ||
- [Documentation](#documentation) | ||
- [Usage](#usage) | ||
@@ -13,0 +12,0 @@ - [Generators](#generators) |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
18139
1
3
349
184
+ Addeddebug@^2.2.0
+ Addeddebug@2.6.9(transitive)
+ Addedms@2.0.0(transitive)