http_chunked.erl 313 B

12345678910111213
  1. %% Feel free to use, reuse and abuse the code in this file.
  2. -module(http_chunked).
  3. -export([init/2]).
  4. init(Req, Opts) ->
  5. Req2 = cowboy_req:chunked_reply(200, Req),
  6. timer:sleep(100),
  7. cowboy_req:chunk("chunked_handler\r\n", Req2),
  8. timer:sleep(100),
  9. cowboy_req:chunk("works fine!", Req2),
  10. {ok, Req2, Opts}.