defmodule Dummy.FastStream do @moduledoc false @behaviour :cowboy_stream def init(_stream_id, req, opts) do env = Map.get(opts, :env, %{}) {:ok, req, %{handler: handler, handler_opts: handler_opts}} = :cowboy_router.execute(req, env) {:ok, _req, _state} = Kernel.apply(handler, :init, [req, handler_opts]) receive do {_, msg} -> {[msg, :stop], :undefined} end end def data(stream_id, is_fin, data, next) do :cowboy_stream.data(stream_id, is_fin, data, next) end def info(stream_id, info, next) do :cowboy_stream.info(stream_id, info, next) end def terminate(stream_id, reason, next) do :cowboy_stream.terminate(stream_id, reason, next) end def early_error(stream_id, reason, partial_req, resp, opts) do :cowboy_stream.early_error(stream_id, reason, partial_req, resp, opts) end end