test/handlers/send_message_h.erl
raw| 1 | %% This module sends a message to the pid passed in a header. |
| 2 | |
| 3 | -module(send_message_h). |
| 4 | -export([init/2]). |
| 5 | |
| 6 | init(Req, State) -> |
| 7 | Pid = list_to_pid(binary_to_list(cowboy_req:header(<<"x-test-pid">>, Req))), |
| 8 | Pid ! {Pid, self(), init, Req, State}, |
| 9 | {ok, cowboy_req:reply(200, Req), State}. |