Skip to content

Commit

Permalink
Remove generateClientRequestId because it's now in ms-rest-js
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Schulte committed May 23, 2018
1 parent 7f2662e commit f39cda9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
24 changes: 11 additions & 13 deletions lib/azureServiceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ export interface AzureServiceClientOptions extends msRest.ServiceClientOptions {
*/
acceptLanguage?: string;

/**
* @property {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value
* is generated and included in each request. Default is true.
*/
generateClientRequestId?: boolean;

/**
* @property {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for
* Long Running Operations. Default value is 30.
Expand All @@ -45,25 +39,19 @@ export interface AzureServiceClientOptions extends msRest.ServiceClientOptions {
*/
export class AzureServiceClient extends msRest.ServiceClient {
acceptLanguage: string = Constants.DEFAULT_LANGUAGE;
generateClientRequestId = true;
longRunningOperationRetryTimeout = 30;
rpRegistrationRetryTimeout = 30;

constructor(credentials: msRest.ServiceClientCredentials, options?: AzureServiceClientOptions) {
super(credentials, options);
super(credentials, updateOptionsWithDefaultValues(options));
this.acceptLanguage = Constants.DEFAULT_LANGUAGE;
this.generateClientRequestId = true;
this.longRunningOperationRetryTimeout = 30;
if (!options) options = {};

if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
this.acceptLanguage = options.acceptLanguage;
}

if (options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) {
this.generateClientRequestId = options.generateClientRequestId;
}

if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout;
}
Expand Down Expand Up @@ -311,4 +299,14 @@ export class AzureServiceClient extends msRest.ServiceClient {

return Promise.resolve(operationResponse);
}
}

function updateOptionsWithDefaultValues(options?: AzureServiceClientOptions): AzureServiceClientOptions {
if (!options) {
options = {};
}
if (options.generateClientRequestIdHeader == undefined) {
options.generateClientRequestIdHeader = true;
}
return options;
}
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"types": "./typings/lib/msRestAzure.d.ts",
"license": "MIT",
"dependencies": {
"ms-rest-js": "^0.7.184"
"ms-rest-js": "^0.7.192"
},
"devDependencies": {
"@types/mocha": "^2.2.43",
Expand Down
2 changes: 1 addition & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"no-null-keyword": true,
"prefer-const": true,
"no-switch-case-fall-through": true,
"triple-equals": true,
"triple-equals": [true, "allow-undefined-check"],
"jsdoc-format": true
}
}

0 comments on commit f39cda9

Please sign in to comment.