azure-iot-http-base
Advanced tools
Comparing version 1.11.9 to 1.11.10
@@ -55,3 +55,3 @@ import { SharedAccessSignature, X509 } from 'azure-iot-common'; | ||
* @method module:azure-iothub.RestApiClient.updateSharedAccessSignature | ||
* @description Updates the shared access signature used to authentify API calls. | ||
* @description Updates the shared access signature used to authenticate API calls. | ||
* | ||
@@ -58,0 +58,0 @@ * @param {string} sharedAccessSignature The new shared access signature that should be used. |
@@ -59,3 +59,3 @@ // Copyright (c) Microsoft. All rights reserved. | ||
function RestApiClient(config, userAgent, httpRequestBuilder) { | ||
this._iotHubPublicScope = ['https://iothubs.azure.net/.default']; | ||
this._iotHubPublicScope = 'https://iothubs.azure.net/.default'; | ||
this._BearerTokenPrefix = 'Bearer '; | ||
@@ -122,11 +122,7 @@ this._MinutesBeforeProactiveRenewal = 9; | ||
if (this._config.tokenCredential) { | ||
var accessToken = this.getToken(); | ||
Promise.resolve(accessToken).then(function (value) { | ||
if (value) { | ||
httpHeaders.Authorization = value; | ||
_this.executeBody(requestBody, httpHeaders, headers, method, path, timeout, requestOptions, done); | ||
} | ||
else { | ||
throw new Error('AccessToken creation failed'); | ||
} | ||
this.getToken().then(function (accessToken) { | ||
httpHeaders.Authorization = accessToken; | ||
_this.executeBody(requestBody, httpHeaders, headers, method, path, timeout, requestOptions, done); | ||
}).catch(function (err) { | ||
done(err); | ||
}); | ||
@@ -143,3 +139,3 @@ } | ||
* @method module:azure-iothub.RestApiClient.updateSharedAccessSignature | ||
* @description Updates the shared access signature used to authentify API calls. | ||
* @description Updates the shared access signature used to authenticate API calls. | ||
* | ||
@@ -173,3 +169,3 @@ * @param {string} sharedAccessSignature The new shared access signature that should be used. | ||
RestApiClient.prototype.isAccessTokenCloseToExpiry = function (accessToken) { | ||
var remainingTimeToLive = Date.now() - accessToken.expiresOnTimestamp; | ||
var remainingTimeToLive = accessToken.expiresOnTimestamp - Date.now(); | ||
return remainingTimeToLive <= this._MillisecsBeforeProactiveRenewal; | ||
@@ -196,9 +192,6 @@ }; | ||
case 2: | ||
if (this._accessToken) { | ||
return [2 /*return*/, this._BearerTokenPrefix + this._accessToken.token]; | ||
if (!this._accessToken) { | ||
throw new Error('AccessToken creation failed'); | ||
} | ||
else { | ||
return [2 /*return*/, null]; | ||
} | ||
return [2 /*return*/]; | ||
return [2 /*return*/, this._BearerTokenPrefix + this._accessToken.token]; | ||
} | ||
@@ -312,3 +305,3 @@ }); | ||
- `response` shall contain the `IncomingMessage` object returned by the HTTP layer. | ||
- `reponseBody` shall contain the content of the HTTP response. | ||
- `responseBody` shall contain the content of the HTTP response. | ||
- `message` shall contain a human-readable error message.]*/ | ||
@@ -315,0 +308,0 @@ var error; |
{ | ||
"name": "azure-iot-http-base", | ||
"version": "1.11.9", | ||
"version": "1.11.10", | ||
"description": "HTTP operations used by Azure IoT device and service SDKs", | ||
@@ -10,3 +10,3 @@ "author": "Microsoft Corporation", | ||
"dependencies": { | ||
"azure-iot-common": "1.12.9", | ||
"azure-iot-common": "1.12.10", | ||
"debug": "^4.3.1", | ||
@@ -21,3 +21,3 @@ "uuid": "^3.3.2" | ||
"nyc": "^15.0.0", | ||
"sinon": "^7.4.1", | ||
"sinon": "^11.1.2", | ||
"source-map-support": "^0.5.16", | ||
@@ -24,0 +24,0 @@ "ts-node": "^8.6.2", |
50794
835
+ Addedazure-iot-common@1.12.10(transitive)
- Removedazure-iot-common@1.12.9(transitive)
Updatedazure-iot-common@1.12.10