I have a couple of functions that perform HTTP POST/GET/HEAD requests.
For the POST request I use this:
http:request(post, {Url, [], ContentType, Body}, [], []).
While for the HEAD/GET I use:
http:request(Method, {Url, []}, [], [])
How can I write this two calls in a unique one? POST request has those two additional variables with respect to GET/HEAD request. I tried with empty lists but I got:
** exception error: no function clause matching
Thank you very much
To use the call to
httpc
only once, you need to extract theRequest
tuple from the call because that's what's unique between the methods as you use them: