Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F140695
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/lib/tesla/adapter/httpc.ex b/lib/tesla/adapter/httpc.ex
index 664248d..6f7cfdc 100644
--- a/lib/tesla/adapter/httpc.ex
+++ b/lib/tesla/adapter/httpc.ex
@@ -1,35 +1,38 @@
defmodule Tesla.Adapter.Httpc do
- def call(env, _opts) do
- with {:ok, {status, headers, body}} <- request(env) do
+ @http_opts ~w(timeout connect_timeout ssl essl autoredirect proxy_auth version relaxed url_encode)a
+
+ def call(env, opts) do
+ with {:ok, {status, headers, body}} <- request(env, opts || []) do
format_response(env, status, headers, body)
end
end
defp format_response(env, {_, status, _}, headers, body) do
%{env | status: status,
headers: headers,
body: body}
end
- defp request(env) do
+ defp request(env, opts) do
content_type = to_char_list(env.headers["content-type"] || "")
handle request(
env.method || :get,
Tesla.build_url(env.url, env.query) |> to_char_list,
Enum.into(env.headers, [], fn {k,v} -> {to_char_list(k), to_char_list(v)} end),
content_type,
- env.body
+ env.body,
+ Keyword.split(opts ++ env.opts, @http_opts)
)
end
- defp request(method, url, headers, _content_type, nil) do
- :httpc.request(method, {url, headers}, [], [])
+ defp request(method, url, headers, _content_type, nil, {http_opts, opts}) do
+ :httpc.request(method, {url, headers}, http_opts, opts)
end
- defp request(method, url, headers, content_type, body) do
- :httpc.request(method, {url, headers, content_type, body}, [], [])
+ defp request(method, url, headers, content_type, body, {http_opts, opts}) do
+ :httpc.request(method, {url, headers, content_type, body}, http_opts, opts)
end
defp handle({:error, {:failed_connect, _}}), do: {:error, :econnrefused}
defp handle(response), do: response
end
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Jan 21, 4:10 AM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
55652
Default Alt Text
(1 KB)
Attached To
Mode
R28 tesla
Attached
Detach File
Event Timeline
Log In to Comment