mndrix/web

configurable request

Opened this issue · 0 comments

I'm not sure if this is a good idea. The first argument of web:get/2 accepts a URL. In some sense, that argument represents the HTTP request. The second argument represents the HTTP response. What if we also accepted a list of options for the first argument:

  • url - specifies the request URL
  • auth(basic(User,Password)) - enables HTTP Basic authentication
  • header(Name,Value) - adds an HTTP request header
  • timeout - maximum time to wait for a response

Most of these are sugar for http_open/3 options so implementation should be fairly easy.