Skip to content

Instantly share code, notes, and snippets.

@nickretallack
Created September 3, 2014 22:25
Show Gist options
  • Save nickretallack/56851f6ee3601cbd564a to your computer and use it in GitHub Desktop.
Save nickretallack/56851f6ee3601cbd564a to your computer and use it in GitHub Desktop.
[{wrq,set_resp_header,
["WWW-Authenticate",false,
{wm_reqdata,'GET',http,
{1,1},
"127.0.0.1","127.0.0.1",undefined,[],"/","/",[],[],".",500,
1073741824,67108864,
[{"splunkweb_csrf_token_8000","16498165946337228917"},
{"session",
"eyJfaWQiOnsiIGIiOiJaakF5TXpJMU1qbGlPV1F3TmpWaFlUWmtObVZpWm1RMFpESmlNekJrTVdZPSJ9LCJjc3JmX3Rva2VuIjp7IiBiIjoiTUdFM1kyTmtPRGt5TkRJMFkyWXhOekkzTldVM01UUmlOVE13T1RGbFltUTVPR1U1WW1FNE9RPT0ifX0.BtbFzg._hor0BK9vEVBx66MJM6JTn5br1I"}],
[],
{8,
{"host",
{'Host',"localhost:8080"},
{"connection",
{'Connection',"keep-alive"},
{"cache-control",
{'Cache-Control',"max-age=0"},
{"accept",
{'Accept',"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"},
nil,
{"accept-encoding",
{'Accept-Encoding',"gzip,deflate,sdch"},
nil,
{"accept-language",
{'Accept-Language',"en-US,en;q=0.8"},
nil,nil}}},
nil},
{"cookie",
{'Cookie',"splunkweb_csrf_token_8000=16498165946337228917; session=eyJfaWQiOnsiIGIiOiJaakF5TXpJMU1qbGlPV1F3TmpWaFlUWmtObVZpWm1RMFpESmlNekJrTVdZPSJ9LCJjc3JmX3Rva2VuIjp7IiBiIjoiTUdFM1kyTmtPRGt5TkRJMFkyWXhOekkzTldVM01UUmlOVE13T1RGbFltUTVPR1U1WW1FNE9RPT0ifX0.BtbFzg._hor0BK9vEVBx66MJM6JTn5br1I"},
nil,nil}},
{"user-agent",
{'User-Agent',"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.94 Safari/537.36"},
nil,nil}}},
not_fetched_yet,false,
{0,nil},
<<>>,follow_request,
["localhost"],
8080,[]}],
[{file,"src/wrq.erl"},{line,188}]},
{webmachine_request,call,2,[{file,"src/webmachine_request.erl"},{line,243}]},
{webmachine_decision_core,wrcall,1,
[{file,"src/webmachine_decision_core.erl"},
{line,42}]},
{webmachine_decision_core,decision,1,
[{file,"src/webmachine_decision_core.erl"},
{line,216}]},
{webmachine_decision_core,handle_request,2,
[{file,"src/webmachine_decision_core.erl"},
{line,33}]},
{webmachine_mochiweb,loop,2,[{file,"src/webmachine_mochiweb.erl"},{line,74}]},
{mochiweb_http,headers,5,[{file,"src/mochiweb_http.erl"},{line,96}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]
-module(mydemo_resource).
-export([
init/1,
to_html/2,
is_authorized/2
]).
-include_lib("webmachine/include/webmachine.hrl").
-spec init(list()) -> {ok, term()}.
init([]) ->
{ok, undefined}.
-spec to_html(wrq:reqdata(), term()) -> {iodata(), wrq:reqdata(), term()}.
to_html(ReqData, State) ->
{"<html><body>Hello, new world</body></html>", ReqData, State}.
is_authorized(ReqData, State) ->
{false, ReqData, State}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment