defp build_pagination_fields(conn, min_id, max_id, extra_params) do
params =
conn.params
- |> Map.drop(Map.keys(conn.path_params))
+ |> Map.drop(Map.keys(conn.path_params) |> Enum.map(&String.to_atom/1))
|> Map.merge(extra_params)
|> Map.drop(@id_keys)
assert String.match?(
next,
- ~r(#{api_endpoint}.*/messages\?id=.*&limit=\d+&max_id=.*; rel=\"next\"$)
+ ~r(#{api_endpoint}.*/messages\?limit=\d+&max_id=.*; rel=\"next\"$)
)
assert String.match?(
prev,
- ~r(#{api_endpoint}.*/messages\?id=.*&limit=\d+&min_id=.*; rel=\"prev\"$)
+ ~r(#{api_endpoint}.*/messages\?limit=\d+&min_id=.*; rel=\"prev\"$)
)
assert length(result) == 20
assert String.match?(
next,
- ~r(#{api_endpoint}.*/messages\?id=.*&limit=\d+&max_id=.*; rel=\"next\"$)
+ ~r(#{api_endpoint}.*/messages\?limit=\d+&max_id=.*; rel=\"next\"$)
)
assert String.match?(
prev,
- ~r(#{api_endpoint}.*/messages\?id=.*&limit=\d+&max_id=.*&min_id=.*; rel=\"prev\"$)
+ ~r(#{api_endpoint}.*/messages\?limit=\d+&max_id=.*&min_id=.*; rel=\"prev\"$)
)
assert length(result) == 10