Skip to content

Fix follow_redirect/3 doc example for regular redirects#4187

Open
preciz wants to merge 1 commit intophoenixframework:mainfrom
preciz:fix-follow-redirect-docs
Open

Fix follow_redirect/3 doc example for regular redirects#4187
preciz wants to merge 1 commit intophoenixframework:mainfrom
preciz:fix-follow-redirect-docs

Conversation

@preciz
Copy link
Copy Markdown
Contributor

@preciz preciz commented Mar 28, 2026

For :redirect the return tuple of follow_redirect is {:ok, conn}.
The 3 tuple is for :live_redirect.

So to match the previous line's logic this has to be the {:ok, conn}.

The function below that shows the correct return value:

{:error, {:redirect, opts}} ->

Comment on lines 1834 to +1835
assert {:error, {:redirect, %{to: "/somewhere"}}} = result = live(conn, "my-path")
{:ok, view, html} = follow_redirect(result, conn)
{:ok, conn} = follow_redirect(result, conn)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we adjust the error tuple to say :live_redirect instead, so the tuple is correct? I think live redirects are more common, so it makes more sense to for this example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants