removing unused method
This commit is contained in:
parent
05429730e4
commit
ee8071f0d5
|
@ -49,26 +49,6 @@ def headers(request, headers) do
|
||||||
@spec opts(Request.t(), keyword()) :: Request.t()
|
@spec opts(Request.t(), keyword()) :: Request.t()
|
||||||
def opts(request, options), do: %{request | opts: options}
|
def opts(request, options), do: %{request | opts: options}
|
||||||
|
|
||||||
# NOTE: isn't used anywhere
|
|
||||||
@doc """
|
|
||||||
Add optional parameters to the request
|
|
||||||
|
|
||||||
"""
|
|
||||||
@spec add_optional_params(Request.t(), %{optional(atom) => atom}, keyword()) :: map()
|
|
||||||
def add_optional_params(request, _, []), do: request
|
|
||||||
|
|
||||||
def add_optional_params(request, definitions, [{key, value} | tail]) do
|
|
||||||
case definitions do
|
|
||||||
%{^key => location} ->
|
|
||||||
request
|
|
||||||
|> add_param(location, key, value)
|
|
||||||
|> add_optional_params(definitions, tail)
|
|
||||||
|
|
||||||
_ ->
|
|
||||||
add_optional_params(request, definitions, tail)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Add optional parameters to the request
|
Add optional parameters to the request
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -36,23 +36,6 @@ test "send custom user agent" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "add_optional_params/3" do
|
|
||||||
test "don't add if keyword is empty" do
|
|
||||||
assert RequestBuilder.add_optional_params(%{}, %{}, []) == %{}
|
|
||||||
end
|
|
||||||
|
|
||||||
test "add query parameter" do
|
|
||||||
assert RequestBuilder.add_optional_params(
|
|
||||||
%Request{},
|
|
||||||
%{query: :query, body: :body, another: :val},
|
|
||||||
[
|
|
||||||
{:query, "param1=val1¶m2=val2"},
|
|
||||||
{:body, "some body"}
|
|
||||||
]
|
|
||||||
) == %Request{query: "param1=val1¶m2=val2", body: "some body"}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "add_param/4" do
|
describe "add_param/4" do
|
||||||
test "add file parameter" do
|
test "add file parameter" do
|
||||||
%Request{
|
%Request{
|
||||||
|
|
Loading…
Reference in New Issue