1defmodule C21palmWeb.Endpoint do 2 use Phoenix.Endpoint, otp_app: :c21palm_web 3 4 # The session will be stored in the cookie and signed, 5 # this means its contents can be read but not tampered with. 6 # Set :encryption_salt if you would also like to encrypt it.
1defmodule C21palmWeb.Endpoint do 2 use Phoenix.Endpoint, otp_app: :c21palm_web 3 4 # The session will be stored in the cookie and signed, 5 # this means its contents can be read but not tampered with. 6 # Set :encryption_salt if you would also like to encrypt it.
60 61 {:plug, conn, handler, opts} -> 62 %{adapter: {@connection, req}} = 63 conn = 64 conn 65 |> handler.call(opts) 66 |> maybe_send(handler) 67 68 :telemetry.execute( 69 [:plug_adapter, :call, :stop], 70 %{duration: System.monotonic_time() - start},
32-optional_callbacks([terminate/3]). 33 34-spec execute(Req, Env) -> {ok, Req, Env} 35 when Req::cowboy_req:req(), Env::cowboy_middleware:env(). 36execute(Req, Env=#{handler := Handler, handler_opts := HandlerOpts}) -> 37 try Handler:init(Req, HandlerOpts) of 38 {ok, Req2, State} -> 39 Result = terminate(normal, Req2, State, Handler), 40 {ok, Req2, Env#{result => Result}}; 41 {Mod, Req2, State} -> 42 Mod:upgrade(Req2, Env, Handler, State);
295 end. 296 297execute(_, _, []) -> 298 ok; 299execute(Req, Env, [Middleware|Tail]) -> 300 case Middleware:execute(Req, Env) of 301 {ok, Req2, Env2} -> 302 execute(Req2, Env2, Tail); 303 {suspend, Module, Function, Args} -> 304 proc_lib:hibernate(?MODULE, resume, [Env, Tail, Module, Function, Args]); 305 {stop, _Req2} ->
286%% to simplify the debugging of errors. The proc_lib library 287%% already adds the stacktrace to other types of exceptions. 288-spec request_process(cowboy_req:req(), cowboy_middleware:env(), [module()]) -> ok. 289request_process(Req, Env, Middlewares) -> 290 try 291 execute(Req, Env, Middlewares) 292 catch 293 exit:Reason:Stacktrace -> 294 erlang:raise(exit, {Reason, Stacktrace}, Stacktrace) 295 end. 296