[errors] when responding to a 401, pass through the www-authenticate header

This commit is contained in:
spalger
2015-10-30 17:37:50 -05:00
parent f269d8b6ad
commit eb90ccb806

View File

@ -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 {