Merge branch 'bugfix/log_non_implemented_mocks' into 'develop'

HttpRequestMock: Log non-implemented mock responses

Closes #1088

See merge request pleroma/pleroma!1416
This commit is contained in:
rinpatch 2019-08-25 08:09:18 +00:00
commit 5853d9c843
1 changed files with 12 additions and 6 deletions

View File

@ -17,9 +17,12 @@ def request(
with {:ok, res} <- apply(__MODULE__, method, [url, query, body, headers]) do with {:ok, res} <- apply(__MODULE__, method, [url, query, body, headers]) do
res res
else else
{_, _r} = error -> error ->
# Logger.warn(r) with {:error, message} <- error do
error Logger.warn(message)
end
{_, _r} = error
end end
end end
@ -970,7 +973,7 @@ def get("https://mstdn.jp/.well-known/webfinger?resource=acct:kpherox@mstdn.jp",
def get(url, query, body, headers) do def get(url, query, body, headers) do
{:error, {:error,
"Not implemented the mock response for get #{inspect(url)}, #{query}, #{inspect(body)}, #{ "Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{
inspect(headers) inspect(headers)
}"} }"}
end end
@ -1032,7 +1035,10 @@ def post("http://404.site" <> _, _, _, _) do
}} }}
end end
def post(url, _query, _body, _headers) do def post(url, query, body, headers) do
{:error, "Not implemented the mock response for post #{inspect(url)}"} {:error,
"Mock response not implemented for POST #{inspect(url)}, #{query}, #{inspect(body)}, #{
inspect(headers)
}"}
end end
end end