Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add put_peer_data to Plug.Test #745

Merged
merged 1 commit into from
Jul 29, 2018

Conversation

mobileoverlord
Copy link
Contributor

There is currently no way to set the peer data in test. This PR adds put_peer_data/2 to Plug.Test

case conn.adapter do
{Plug.MissingAdapter, _} -> %{address: {127, 0, 0, 1}, port: 111_317, ssl_cert: nil}
{adapter, payload} -> adapter.get_peer_data(payload)
end,
Copy link
Member

Choose a reason for hiding this comment

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

Let's encapsulate this in a function given this and the code below do the same thing?

For example, get_from_adapter(conn, op, default) which we would call as get_from_adapter(conn, :get_peer_data, %{address: {127, 0, 0, 1}, port: 111_317, ssl_cert: nil})?

@josevalim josevalim merged commit 4e2f6d2 into elixir-plug:master Jul 29, 2018
@josevalim
Copy link
Member

❤️ 💚 💙 💛 💜

josevalim pushed a commit that referenced this pull request Aug 4, 2018
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
Gazler pushed a commit to Gazler/plug that referenced this pull request Oct 18, 2018
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