Skip to content

Add put_peer_data to Plug.Test#745

Merged
josevalim merged 1 commit into
elixir-plug:masterfrom
mobileoverlord:peer_conn
Jul 29, 2018
Merged

Add put_peer_data to Plug.Test#745
josevalim merged 1 commit into
elixir-plug:masterfrom
mobileoverlord:peer_conn

Conversation

@mobileoverlord

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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