send_message_h.erl 288 B

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