diff --git a/AUTHORS b/AUTHORS index 777589b..65b5f6d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,3 +6,4 @@ Isaac Schlueter (https://github.com/isaacs) Rob Gulewich (https://github.com/rgulewich) Bryan Cantrill (https://github.com/bcantrill) Michael Hart (https://github.com/mhart) +Simon Wade (https://github.com/aexmachina) diff --git a/CHANGES.md b/CHANGES.md index d706905..3c5e7ec 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,9 @@ Known issues: ## bunyan 0.23.0 (not yet released) +- [pull #42] Fix `bunyan` crash on a log record with `req.headers` that is a *string* + (by https://github.com/aexmachina). + - Drop node 0.6 support. I can't effectively `npm install` with a node 0.6 anymore. diff --git a/bin/bunyan b/bin/bunyan index bf1040f..41241aa 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -756,11 +756,9 @@ function emitRecord(rec, line, opts, stylize) { var headers = req.headers; if (!headers) { headers = ''; - } - else if (typeof headers === 'string') { + } else if (typeof (headers) === 'string') { headers = '\n' + headers; - } - else if (typeof headers === 'object') { + } else if (typeof (headers) === 'object') { headers = '\n' + Object.keys(headers).map(function (h) { return h + ': ' + headers[h]; }).join('\n');