encode url before sending it in testQuery