Permalink
Browse files

#599: Add user agent header to requests

  • Loading branch information...
1 parent a12683f commit 4f386186281e519609c81e47649c16d6d32b5a23 Andre Rodrigues committed Jan 30, 2013
Showing with 11 additions and 9 deletions.
  1. +10 −0 lib/services/core/serviceclient.js
  2. +0 −8 lib/util/constants.js
  3. +1 −1 test/services/blob/blobservice-tests.js
@@ -206,6 +206,8 @@ ServiceClient.prototype._performRequest = function (webResource, body, options,
finalCallback(requestOptions);
});
} else {
+ self._tagRequest(requestOptions);
+
self.logger.log(Logger.LogLevels.DEBUG, "REQUEST OPTIONS:\n" + util.inspect(requestOptions));
var operation = function (finalRequestOptions, operationCallback, next) {
@@ -284,6 +286,14 @@ ServiceClient.prototype._performRequest = function (webResource, body, options,
});
};
+ServiceClient.prototype._tagRequest = function (requestOptions) {
+ if (!this.userAgent) {
+ this.userAgent = util.format('Windows Azure SDK/%s (%s)', require('../../../package.json').version, process.platform);
+ }
+
+ requestOptions.headers[HeaderConstants.USER_AGENT] = this.userAgent;
+};
+
/**
* Process the response.
*
View
@@ -2112,14 +2112,6 @@ var Constants = {
USER_AGENT: 'user-agent',
/**
- * Specifies the value to use for UserAgent header.
- *
- * @const
- * @type {string}
- */
- USER_AGENT_PREFIX: 'WA-Storage',
-
- /**
* The pop receipt header.
*
* @const
@@ -1289,7 +1289,7 @@ suite('blobservice-tests', function () {
var sharedAccessPolicy = {
AccessPolicy: {
- Expiry: azure.date.minutesFromNow(10);
+ Expiry: azure.date.minutesFromNow(10)
}
};

0 comments on commit 4f38618

Please sign in to comment.