do not attach query to url if it is undefined