fix getUrl to accept query without params in pattern.