diff --git a/src/lib/transport.js b/src/lib/transport.js index 6e18112ec..3e3575336 100644 --- a/src/lib/transport.js +++ b/src/lib/transport.js @@ -252,6 +252,10 @@ Transport.prototype.request = function (params, cb) { errorMetadata.statusCode = status; errorMetadata.response = body; + if (status === 401 && headers && headers['www-authenticate']) { + errorMetadata.wwwAuthenticateDirective = headers['www-authenticate']; + } + if (errors[status]) { err = new errors[status](parsedBody && parsedBody.error, errorMetadata); } else {