end
def followers(%{assigns: %{user: for_user}} = conn, params) do
- page = params["page"] || 1
+ {:ok, page} = Ecto.Type.cast(:integer, params["page"] || 1)
with {:ok, user} <- TwitterAPI.get_user(for_user, params),
{:ok, followers} <- User.get_followers(user, page) do
end
def friends(%{assigns: %{user: for_user}} = conn, params) do
- page = params["page"] || 1
+ {:ok, page} = Ecto.Type.cast(:integer, params["page"] || 1)
with {:ok, user} <- TwitterAPI.get_user(conn.assigns[:user], params),
{:ok, friends} <- User.get_friends(user, page) do
res_conn =
conn
|> assign(:user, user)
- |> get("/api/statuses/followers", %{page: 2})
+ |> get("/api/statuses/followers?page=2")
result = json_response(res_conn, 200)
assert length(result) == 1