Skip to content

Instantly share code, notes, and snippets.

@shankardevy
Created June 23, 2015 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shankardevy/33ef2435bfe5c58bbdc8 to your computer and use it in GitHub Desktop.
Save shankardevy/33ef2435bfe5c58bbdc8 to your computer and use it in GitHub Desktop.
def fetch(url, {:basic, auth}) do
[username, password] = String.split(auth, ":")
request = HTTPotion.get(url, [basic_auth: {username, password}])
request.body
end
def fetch(url, {:digest, auth}) do
digest_request = Porcelain.shell("curl --max-time 15 --digest --user '#{auth}' #{url}")
digest_request.out
end
def fetch(url, {:cookie, auth}) do
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment