I want to make REST call using spring RestTemplate, the URL contains some optional query params. The URL looks something like
url = example.com/param1={param1}¶m2={param2}
I pass params as map to restTemplate using exchange method
restTemplate.exchange(url, method, payLoad, String.class, params)
The final URL is example.com/param1=somevalue¶m2= since param2 was not present in params map.
I want to remove param2 from the request, that is, the final URL should contain only param1 and URL should look like example.com/param1=somevalue