Skip to content

Instantly share code, notes, and snippets.

@jamonholmgren
Created March 9, 2016 07:00
Show Gist options
  • Save jamonholmgren/fc3b995d2704b1780b55 to your computer and use it in GitHub Desktop.
Save jamonholmgren/fc3b995d2704b1780b55 to your computer and use it in GitHub Desktop.
Typical Elixir Phoenix Plug.Conn struct contents, in an easy-to-read format. By Jamon Holmgren.
%Plug.Conn{
adapter: {Plug.Adapters.Cowboy.Conn, :...},
assigns: %{
my_assigns: "here"
},
before_send: [
#Function<7.125546534/1 in Phoenix.Controller.fetch_flash/2>,
#Function<1.127904613/1 in Plug.Session.before_send/2>,
#Function<1.43511252/1 in Plug.Logger.call/2>,
#Function<0.70322810/1 in Phoenix.LiveReloader.before_send_inject_reloader/1>
],
body_params: %{},
cookies: %{
"my_cookie" => "whatever",
},
halted: false,
host: "localhost",
method: "GET",
owner: #PID<0.810.0>,
params: %{},
path_info: [],
peer: {{127, 0, 0, 1}, 53135},
port: 4000,
private: %{
MyApp.Router => {[], %{}},
:phoenix_action => :index,
:phoenix_controller => MyApp.PageController,
:phoenix_endpoint => MyApp.Endpoint,
:phoenix_flash => %{},
:phoenix_format => "html",
:phoenix_layout => {MyApp.LayoutView, :app},
:phoenix_pipelines => [:browser],
:phoenix_route => #Function<26.115114952/1 in MyApp.Router.match_route/4>,
:phoenix_router => MyApp.Router,
:phoenix_view => MyApp.PageView,
:plug_session => %{"current_user" => %MyApp.User{...}},
:plug_session_fetch => :done
},
query_params: %{},
query_string: "",
remote_ip: {127, 0, 0, 1},
req_cookies: %{
"_myapp_key" => "asdfjasdf=",
},
req_headers: [
{"host", "localhost:4000"},
{"connection", "keep-alive"},
{"cache-control", "max-age=0"},
{"accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"},
{"upgrade-insecure-requests", "1"},
{"user-agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36"},
{"referer", "http://localhost:4000/"},
{"accept-encoding", "gzip, deflate, sdch"},
{"accept-language", "en-US,en;q=0.8"},
{"cookie", "referrer=; _myapp_key=asdfjasdf="}
],
request_path: "/",
resp_body: nil,
resp_cookies: %{},
resp_headers: [
{"cache-control", "max-age=0, private, must-revalidate"},
{"x-request-id", "asdf"},
{"x-frame-options", "SAMEORIGIN"},
{"x-xss-protection", "1; mode=block"},
{"x-content-type-options", "nosniff"}, {"access-control-allow-origin", "*"}
],
scheme: :http,
script_name: [],
secret_key_base: "asdf",
state: :unset,
status: nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment