Reputation: 1573
My query to Wolfram Alpha fails when using iex behind a proxy. I tried setting the proxy using
iex(1)> :httpc.set_options({:proxy, {"proxy.mycompany.org", 1234}})
but this is giving a CaseClauseError error. How do I set options within iex for this Erlang library? Thank you.
Background: I am going through the book "Programming Phoenix"
Upvotes: 0
Views: 359
Reputation: 222318
Three things:
set_options
accepts a list of options, not one option.
The hostname must be an Erlang string, which is called a charlist in Elixir, and is created using single quotes in Elixir.
That option requires a tuple {Proxy, NoProxy}
where NoProxy
is a list of NoProxyDesc
options. You might want to read the documentation for that; I'm using an empty list below.
You can also use the keyword list syntax to make this slightly shorter:
iex(1)> :httpc.set_options([{:proxy, {{'proxy.mycompany.org', 1234}, []}}])
:ok
You can also use the keyword list syntax to make this slightly shorter:
iex(2)> :httpc.set_options([proxy: {{'proxy.mycompany.org', 1234}, []}])
:ok
Upvotes: 3