Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in the CommonAccessTokenController.js that leads to null va… #4434

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/streaming/controllers/CommonAccessTokenController.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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