Make getProtocolAndHost work on URLs that doesn't end with `/`