fix warnings
This commit is contained in:
@ -2,8 +2,11 @@ defmodule SomethingErlang.AwfulApi.Client do
|
||||
@base_url "https://forums.somethingawful.com/"
|
||||
@user_agent "SomethingErlangClient/0.1"
|
||||
|
||||
require Logger
|
||||
|
||||
def thread_doc(id, page, user) do
|
||||
resp = new(user) |> get_thread(id, page)
|
||||
Logger.debug("Client reply in #{resp.private.time}ms ")
|
||||
:unicode.characters_to_binary(resp.body, :latin1)
|
||||
end
|
||||
|
||||
@ -66,8 +69,16 @@ defmodule SomethingErlang.AwfulApi.Client do
|
||||
cache: true,
|
||||
headers: [cookie: [cookies(%{bbuserid: user.id, bbpassword: user.hash})]]
|
||||
)
|
||||
|
||||
# |> Req.Request.append_request_steps(inspect: &IO.inspect/1)
|
||||
|> Req.Request.append_request_steps(
|
||||
time: fn req -> Req.Request.put_private(req, :time, Time.utc_now()) end
|
||||
)
|
||||
|> Req.Request.prepend_response_steps(
|
||||
time: fn {req, res} ->
|
||||
start = req.private.time
|
||||
diff = Time.diff(Time.utc_now(), start, :millisecond)
|
||||
{req, Req.Response.put_private(res, :time, diff)}
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
defp new() do
|
||||
@ -76,8 +87,6 @@ defmodule SomethingErlang.AwfulApi.Client do
|
||||
user_agent: @user_agent,
|
||||
redirect: false
|
||||
)
|
||||
|
||||
# |> Req.Request.append_request_steps(inspect: &IO.inspect/1)
|
||||
end
|
||||
|
||||
defp cookies(args) when is_map(args) do
|
||||
|
Reference in New Issue
Block a user