aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/http_SUITE.erl58
-rw-r--r--test/http_SUITE_data/http_multipart.erl18
-rw-r--r--test/http_SUITE_data/http_multipart_stream.erl27
3 files changed, 0 insertions, 103 deletions
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl
index e57e384..2cd8387 100644
--- a/test/http_SUITE.erl
+++ b/test/http_SUITE.erl
@@ -160,8 +160,6 @@ init_dispatch(Config) ->
[{etag, ?MODULE, do_etag_gen}]}},
{"/static_specify_file/[...]", cowboy_static,
{file, config(static_dir, Config) ++ "/style.css"}},
- {"/multipart", http_multipart, []},
- {"/multipart/large", http_multipart_stream, []},
{"/echo/body", http_echo_body, []},
{"/echo/body_qs", http_body_qs, []},
{"/crash/content-length", input_crash_h, content_length},
@@ -446,62 +444,6 @@ keepalive_stream_loop(Config) ->
end || Ref <- Refs],
ok.
-multipart(Config) ->
- ConnPid = gun_open(Config),
- Body = <<
- "This is a preamble."
- "\r\n--OHai\r\nX-Name:answer\r\n\r\n42"
- "\r\n--OHai\r\nServer:Cowboy\r\n\r\nIt rocks!\r\n"
- "\r\n--OHai--\r\n"
- "This is an epilogue."
- >>,
- Ref = gun:post(ConnPid, "/multipart",
- [{<<"content-type">>, <<"multipart/x-makes-no-sense; boundary=OHai">>}],
- Body),
- {response, nofin, 200, _} = gun:await(ConnPid, Ref),
- {ok, RespBody} = gun:await_body(ConnPid, Ref),
- Parts = binary_to_term(RespBody),
- Parts = [
- {[{<<"x-name">>, <<"answer">>}], <<"42">>},
- {[{<<"server">>, <<"Cowboy">>}], <<"It rocks!\r\n">>}
- ],
- ok.
-
-multipart_chunked(Config) ->
- ConnPid = gun_open(Config),
- Body = <<
- "This is a preamble."
- "\r\n--OHai\r\nX-Name:answer\r\n\r\n42"
- "\r\n--OHai\r\nServer:Cowboy\r\n\r\nIt rocks!\r\n"
- "\r\n--OHai--\r\n"
- "This is an epilogue."
- >>,
- Ref = gun:post(ConnPid, "/multipart",
- [{<<"content-type">>, <<"multipart/x-makes-no-sense; boundary=OHai">>}]),
- gun:data(ConnPid, Ref, fin, Body),
- {response, nofin, 200, _} = gun:await(ConnPid, Ref),
- {ok, RespBody} = gun:await_body(ConnPid, Ref),
- Parts = binary_to_term(RespBody),
- Parts = [
- {[{<<"x-name">>, <<"answer">>}], <<"42">>},
- {[{<<"server">>, <<"Cowboy">>}], <<"It rocks!\r\n">>}
- ],
- ok.
-
-multipart_large(Config) ->
- ConnPid = gun_open(Config),
- Boundary = "----------",
- Big = << 0:9000000/unit:8 >>,
- Bigger = << 0:9999999/unit:8 >>,
- Body = ["--", Boundary, "\r\ncontent-length: 9000000\r\n\r\n", Big, "\r\n",
- "--", Boundary, "\r\ncontent-length: 9999999\r\n\r\n", Bigger, "\r\n",
- "--", Boundary, "--\r\n"],
- Ref = gun:post(ConnPid, "/multipart/large",
- [{<<"content-type">>, ["multipart/x-large; boundary=", Boundary]}],
- Body),
- {response, fin, 200, _} = gun:await(ConnPid, Ref),
- ok.
-
do_nc(Config, Input) ->
Cat = os:find_executable("cat"),
Nc = os:find_executable("nc"),
diff --git a/test/http_SUITE_data/http_multipart.erl b/test/http_SUITE_data/http_multipart.erl
deleted file mode 100644
index 5a4c6be..0000000
--- a/test/http_SUITE_data/http_multipart.erl
+++ /dev/null
@@ -1,18 +0,0 @@
-%% Feel free to use, reuse and abuse the code in this file.
-
--module(http_multipart).
-
--export([init/2]).
-
-init(Req, Opts) ->
- {Result, Req2} = acc_multipart(Req, []),
- {ok, cowboy_req:reply(200, #{}, term_to_binary(Result), Req2), Opts}.
-
-acc_multipart(Req, Acc) ->
- case cowboy_req:read_part(Req) of
- {ok, Headers, Req2} ->
- {ok, Body, Req3} = cowboy_req:read_part_body(Req2),
- acc_multipart(Req3, [{Headers, Body}|Acc]);
- {done, Req2} ->
- {lists:reverse(Acc), Req2}
- end.
diff --git a/test/http_SUITE_data/http_multipart_stream.erl b/test/http_SUITE_data/http_multipart_stream.erl
deleted file mode 100644
index 88cf611..0000000
--- a/test/http_SUITE_data/http_multipart_stream.erl
+++ /dev/null
@@ -1,27 +0,0 @@
-%% Feel free to use, reuse and abuse the code in this file.
-
--module(http_multipart_stream).
-
--export([init/2]).
-
-init(Req, Opts) ->
- Req2 = multipart(Req),
- {ok, cowboy_req:reply(200, Req2), Opts}.
-
-multipart(Req) ->
- case cowboy_req:read_part(Req) of
- {ok, [{<<"content-length">>, BinLength}], Req2} ->
- Length = binary_to_integer(BinLength),
- {Length, Req3} = stream_body(Req2, 0),
- multipart(Req3);
- {done, Req2} ->
- Req2
- end.
-
-stream_body(Req, N) ->
- case cowboy_req:read_part_body(Req) of
- {ok, Data, Req2} ->
- {N + byte_size(Data), Req2};
- {more, Data, Req2} ->
- stream_body(Req2, N + byte_size(Data))
- end.