-
Notifications
You must be signed in to change notification settings - Fork 240
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
URL without host should not fails canIncludeCorrelationHeader right away #1583
Conversation
@@ -65,7 +65,7 @@ export function urlGetCompleteUrl(method: string, absoluteUrl: string) { | |||
|
|||
// Fallback method to grab host from url if document.createElement method is not available | |||
export function urlParseHost(url: string, inclPort?: boolean) { | |||
let fullHost = urlParseFullHost(url, inclPort); | |||
let fullHost = urlParseFullHost(url, inclPort) || ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add | ""
means when url has no host, the urlParseFullHost
method returns null
. In that case, null
passed back to here but null.toLowerCase()
is wrong. So always return an empty string when host is not detected.
@@ -238,9 +238,9 @@ export interface IUtil { | |||
|
|||
export const Util: IUtil = { | |||
NotSpecified: strNotSpecified, | |||
createDomEvent: createDomEvent, | |||
createDomEvent, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix some ts-lint errors
@@ -355,7 +355,7 @@ export const CorrelationIdHelper: ICorrelationIdHelper = { | |||
requestHost = (urlParseFullHost(requestUrl, true) || "").toLowerCase(); | |||
} | |||
|
|||
if ((!config || !config.enableCorsCorrelation) && requestHost !== currentHost) { | |||
if ((!config || !config.enableCorsCorrelation) && (requestHost && requestHost !== currentHost)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ONLY check if the requestHost equals currentHost when requestHost exists. For the case that requestHost not exist (empty string when host not exist) skip the check. Otherwise it will returns false right away for the cases that url without host.
#1580