krakenjs/cross-domain-utils

getDomainFromUrl needs unit tests and is not working as expected.

Closed this issue · 2 comments

Hi, I noticed that the getDomainFromUrl does not have unit tests and from my preliminary testing is not behaving as expected.

e.g on inputting https://www.google.com/ the returned value should be google.com but it in fact returns https://www.google.com.

I'd like to open this issue to start working on a PR that can reference this issue.

Hi @Abdul-Sen,

Thanks for taking this up! I agree this function is probably badly named. That said, we probably can not change the behavior at this point due to several other libraries depending on this. Right now this returns the full protocol+domain to be used in browser apis (like window.postMessage()) which expect both.

Oh thanks for clearing that up, makes much more sense. In any case I will go ahead and close this issue but continue to add more tests through #12