http_handler.erl 355 B

1234567891011121314
  1. %% Feel free to use, reuse and abuse the code in this file.
  2. -module(http_handler).
  3. -export([init/2]).
  4. -export([handle/2]).
  5. init(Req, Opts) ->
  6. {http, Req, Opts}.
  7. handle(Req, State) ->
  8. Headers = proplists:get_value(headers, State, []),
  9. Body = proplists:get_value(body, State, "http_handler"),
  10. {ok, cowboy_req:reply(200, Headers, Body, Req), State}.