aboutsummaryrefslogtreecommitdiffstats
path: root/test/handlers/accept_callback_h.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-22 00:12:18 +0100
committerLoïc Hoguin <[email protected]>2018-11-22 00:12:18 +0100
commit0223f69fcd2252a4b686b2815e6ee287b1484551 (patch)
treeadc934ca725cd23d7e7a76514ae732bbc62c3cac /test/handlers/accept_callback_h.erl
parent037b286aa85acaaf439011bd7d2ae38685ce2f2e (diff)
downloadcowboy-0223f69fcd2252a4b686b2815e6ee287b1484551.tar.gz
cowboy-0223f69fcd2252a4b686b2815e6ee287b1484551.tar.bz2
cowboy-0223f69fcd2252a4b686b2815e6ee287b1484551.zip
Move the final old HTTP suite tests and remove it
Diffstat (limited to 'test/handlers/accept_callback_h.erl')
-rw-r--r--test/handlers/accept_callback_h.erl23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/handlers/accept_callback_h.erl b/test/handlers/accept_callback_h.erl
new file mode 100644
index 0000000..1912e9f
--- /dev/null
+++ b/test/handlers/accept_callback_h.erl
@@ -0,0 +1,23 @@
+%% This module returns something different in
+%% AcceptCallback depending on the query string.
+
+-module(accept_callback_h).
+
+-export([init/2]).
+-export([allowed_methods/2]).
+-export([content_types_accepted/2]).
+-export([put_text_plain/2]).
+
+init(Req, Opts) ->
+ {cowboy_rest, Req, Opts}.
+
+allowed_methods(Req, State) ->
+ {[<<"PUT">>, <<"POST">>, <<"PATCH">>], Req, State}.
+
+content_types_accepted(Req, State) ->
+ {[{{<<"text">>, <<"plain">>, []}, put_text_plain}], Req, State}.
+
+put_text_plain(Req=#{qs := <<"false">>}, State) ->
+ {false, Req, State};
+put_text_plain(Req=#{qs := <<"true">>}, State) ->
+ {true, Req, State}.