Skip to content

Commit

Permalink
Fix a bug in the CommonAccessTokenController.js that leads to null va…
Browse files Browse the repository at this point in the history
…lues for the token. (#4434)
  • Loading branch information
dsilhavy committed Mar 21, 2024
1 parent 4ef8359 commit e96f7ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/streaming/controllers/CommonAccessTokenController.js
Expand Up @@ -44,8 +44,12 @@ function CommonAccessTokenController() {
}

const commonAccessTokenHeader = httpResponse.headers[Constants.COMMON_ACCESS_TOKEN_HEADER]
const host = Utils.getHostFromUrl(httpResponse.request.url)
hostTokenMap[host] = commonAccessTokenHeader
if (commonAccessTokenHeader) {
const host = Utils.getHostFromUrl(httpResponse.request.url)
if (host) {
hostTokenMap[host] = commonAccessTokenHeader
}
}
}

function getCommonAccessTokenForUrl(url) {
Expand Down
8 changes: 4 additions & 4 deletions src/streaming/net/HTTPLoader.js
Expand Up @@ -249,7 +249,7 @@ function HTTPLoader(cfg) {
if (aborted) {
if (config.abort) {
config.abort(requestObject);
}
}
return;
}

Expand Down Expand Up @@ -285,13 +285,13 @@ function HTTPLoader(cfg) {

};

const _updateRequestTimingInfo = function() {
const _updateRequestTimingInfo = function () {
requestObject.startDate = requestStartTime;
requestObject.endDate = new Date();
requestObject.firstByteDate = requestObject.firstByteDate || requestStartTime;
}

const _updateResourceTimingInfo = function() {
const _updateResourceTimingInfo = function () {
httpResponse.resourceTiming.responseEnd = Date.now();

// If enabled the ResourceTimingApi we add the corresponding information to the request object.
Expand All @@ -315,7 +315,7 @@ function HTTPLoader(cfg) {
});
});
}

/**
* Retriggers the request in case we did not exceed the number of retry attempts
* @private
Expand Down

0 comments on commit e96f7ce

Please sign in to comment.