aboutsummaryrefslogtreecommitdiffstats
path: root/test/handlers/set_options_h.erl
diff options
context:
space:
mode:
Diffstat (limited to 'test/handlers/set_options_h.erl')
-rw-r--r--test/handlers/set_options_h.erl20
1 files changed, 5 insertions, 15 deletions
diff --git a/test/handlers/set_options_h.erl b/test/handlers/set_options_h.erl
index ef88a6f..420b3f9 100644
--- a/test/handlers/set_options_h.erl
+++ b/test/handlers/set_options_h.erl
@@ -9,32 +9,22 @@ init(Req, State) ->
set_options(cowboy_req:binding(key, Req), Req, State).
set_options(<<"chunked_false">>, Req0, State) ->
- %% @todo This should be replaced by a cowboy_req:cast/cowboy_stream:cast.
- #{pid := Pid, streamid := StreamID} = Req0,
- Pid ! {{Pid, StreamID}, {set_options, #{chunked => false}}},
+ cowboy_req:cast({set_options, #{chunked => false}}, Req0),
Req = cowboy_req:stream_reply(200, Req0),
cowboy_req:stream_body(<<0:8000000>>, fin, Req),
{ok, Req, State};
set_options(<<"chunked_false_ignored">>, Req0, State) ->
- %% @todo This should be replaced by a cowboy_req:cast/cowboy_stream:cast.
- #{pid := Pid, streamid := StreamID} = Req0,
- Pid ! {{Pid, StreamID}, {set_options, #{chunked => false}}},
+ cowboy_req:cast({set_options, #{chunked => false}}, Req0),
Req = cowboy_req:reply(200, #{}, <<"Hello world!">>, Req0),
{ok, Req, State};
set_options(<<"idle_timeout_short">>, Req0, State) ->
- %% @todo This should be replaced by a cowboy_req:cast/cowboy_stream:cast.
- #{pid := Pid, streamid := StreamID} = Req0,
- Pid ! {{Pid, StreamID}, {set_options, #{idle_timeout => 500}}},
+ cowboy_req:cast({set_options, #{idle_timeout => 500}}, Req0),
{_, Body, Req} = cowboy_req:read_body(Req0),
{ok, cowboy_req:reply(200, #{}, Body, Req), State};
set_options(<<"idle_timeout_long">>, Req0, State) ->
- %% @todo This should be replaced by a cowboy_req:cast/cowboy_stream:cast.
- #{pid := Pid, streamid := StreamID} = Req0,
- Pid ! {{Pid, StreamID}, {set_options, #{idle_timeout => 60000}}},
+ cowboy_req:cast({set_options, #{idle_timeout => 60000}}, Req0),
{_, Body, Req} = cowboy_req:read_body(Req0),
{ok, cowboy_req:reply(200, #{}, Body, Req), State};
set_options(<<"metrics_user_data">>, Req, State) ->
- %% @todo This should be replaced by a cowboy_req:cast/cowboy_stream:cast.
- #{pid := Pid, streamid := StreamID} = Req,
- Pid ! {{Pid, StreamID}, {set_options, #{metrics_user_data => #{handler => ?MODULE}}}},
+ cowboy_req:cast({set_options, #{metrics_user_data => #{handler => ?MODULE}}}, Req),
{ok, cowboy_req:reply(200, #{}, <<"Hello world!">>, Req), State}.