http发布请求erlang

| 我有几个执行HTTP POST / GET / HEAD请求的功能。 对于POST请求,我使用以下命令:
  http:request(post, {Url, [], ContentType, Body}, [], []).
对于HEAD / GET,我使用:
  http:request(Method, {Url, []}, [], [])
如何在一个唯一的电话中编写这两个电话? POST请求相对于GET / HEAD请求具有这两个附加变量。我尝试使用空列表,但得到了:
  ** exception error: no function clause matching
非常感谢你     
已邀请:
        要只对
httpc
使用一次调用,您需要从调用中提取
Request
元组,因为这是使用方法之间的唯一之处:
post(URL, ContentType, Body) -> request(post, {URL, [], ContentType, Body}).
get(URL)                     -> request(get,  {URL, []}).
head(URL)                    -> request(head, {URL, []}).

request(Method, Request) ->
    httpc:request(Method, Request, [], []).
    
        
Body = \"name=<<name>>&pass=<<pass>>\",
httpc:request(post, {Url, [], \"application/x-www-form-urlencoded\", Body}, [], []).
    

要回复问题请先登录注册