diff options
Diffstat (limited to 'src/node/index.js')
-rw-r--r-- | src/node/index.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/node/index.js b/src/node/index.js index 889b0ac0e9..51d3fa590c 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -41,6 +41,8 @@ var client = require('./src/client.js'); var server = require('./src/server.js'); +var Metadata = require('./src/metadata.js'); + var grpc = require('bindings')('grpc'); /** @@ -107,18 +109,12 @@ exports.getGoogleAuthDelegate = function getGoogleAuthDelegate(credential) { * @param {function(Error, Object)} callback */ return function updateMetadata(authURI, metadata, callback) { - metadata = _.clone(metadata); - if (metadata.Authorization) { - metadata.Authorization = _.clone(metadata.Authorization); - } else { - metadata.Authorization = []; - } credential.getRequestMetadata(authURI, function(err, header) { if (err) { callback(err); return; } - metadata.Authorization.push(header.Authorization); + metadata.add('authorization', header.Authorization); callback(null, metadata); }); }; @@ -130,6 +126,11 @@ exports.getGoogleAuthDelegate = function getGoogleAuthDelegate(credential) { exports.Server = server.Server; /** + * @see module:src/metadata + */ +exports.Metadata = Metadata; + +/** * Status name to code number mapping */ exports.status = grpc.status; |