PhoenixIntegration.Requests.follow_fn

You're seeing just the function follow_fn, go back to PhoenixIntegration.Requests module for more information.
Link to this function

follow_fn(conn, func, opts \\ %{})

View Source

Calls a function and follows the any redirects in the returned conn. If the function returns anything other than a conn, then the result is ignored and follow_fn will simply return the original conn

This gives a way to insert custom assertions, or other setup code without breaking the piped chain of functions.

Parameters

  • conn A conn that has been set up to work in the test environment. Could be the conn originally passed in to the test;
  • func a function in the form of fn(conn) -> end;
  • opts A map of additional options
    • :max_redirects - Maximum number of redirects to follow. Defaults to 5;

Example:

follow_fn( conn, fn(c) ->
    "/some_path/" <> token = c.request_path
    assert token == "valid_token"
  end)