diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/handlers/multipart_h.erl | 12 | ||||
-rw-r--r-- | test/http_SUITE_data/http_multipart.erl | 4 | ||||
-rw-r--r-- | test/http_SUITE_data/http_multipart_stream.erl | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/test/handlers/multipart_h.erl b/test/handlers/multipart_h.erl index 289d2ed..1b9297b 100644 --- a/test/handlers/multipart_h.erl +++ b/test/handlers/multipart_h.erl @@ -14,7 +14,7 @@ init(Req0, State) -> {ok, cowboy_req:reply(200, #{}, term_to_binary(Result), Req), State}. acc_multipart(Req0, Acc) -> - case cowboy_req:part(Req0) of + case cowboy_req:read_part(Req0) of {ok, Headers, Req1} -> {ok, Body, Req} = stream_body(Req1, <<>>), acc_multipart(Req, [{Headers, Body}|Acc]); @@ -23,7 +23,7 @@ acc_multipart(Req0, Acc) -> end. stream_body(Req0, Acc) -> - case cowboy_req:part_body(Req0) of + case cowboy_req:read_part_body(Req0) of {more, Data, Req} -> stream_body(Req, << Acc/binary, Data/binary >>); {ok, Data, Req} -> @@ -31,7 +31,7 @@ stream_body(Req0, Acc) -> end. skip_body_multipart(Req0, Acc) -> - case cowboy_req:part(Req0) of + case cowboy_req:read_part(Req0) of {ok, Headers, Req} -> skip_body_multipart(Req, [Headers|Acc]); {done, Req} -> @@ -39,7 +39,7 @@ skip_body_multipart(Req0, Acc) -> end. read_part2_multipart(Req0, Acc) -> - case cowboy_req:part(Req0, #{length => 1, period => 1}) of + case cowboy_req:read_part(Req0, #{length => 1, period => 1}) of {ok, Headers, Req1} -> {ok, Body, Req} = stream_body(Req1, <<>>), acc_multipart(Req, [{Headers, Body}|Acc]); @@ -48,7 +48,7 @@ read_part2_multipart(Req0, Acc) -> end. read_part_body2_multipart(Req0, Acc) -> - case cowboy_req:part(Req0) of + case cowboy_req:read_part(Req0) of {ok, Headers, Req1} -> {ok, Body, Req} = stream_body2(Req1, <<>>), acc_multipart(Req, [{Headers, Body}|Acc]); @@ -57,7 +57,7 @@ read_part_body2_multipart(Req0, Acc) -> end. stream_body2(Req0, Acc) -> - case cowboy_req:part_body(Req0, #{length => 1, period => 1}) of + case cowboy_req:read_part_body(Req0, #{length => 1, period => 1}) of {more, Data, Req} -> stream_body(Req, << Acc/binary, Data/binary >>); {ok, Data, Req} -> diff --git a/test/http_SUITE_data/http_multipart.erl b/test/http_SUITE_data/http_multipart.erl index 212f569..5a4c6be 100644 --- a/test/http_SUITE_data/http_multipart.erl +++ b/test/http_SUITE_data/http_multipart.erl @@ -9,9 +9,9 @@ init(Req, Opts) -> {ok, cowboy_req:reply(200, #{}, term_to_binary(Result), Req2), Opts}. acc_multipart(Req, Acc) -> - case cowboy_req:part(Req) of + case cowboy_req:read_part(Req) of {ok, Headers, Req2} -> - {ok, Body, Req3} = cowboy_req:part_body(Req2), + {ok, Body, Req3} = cowboy_req:read_part_body(Req2), acc_multipart(Req3, [{Headers, Body}|Acc]); {done, Req2} -> {lists:reverse(Acc), Req2} diff --git a/test/http_SUITE_data/http_multipart_stream.erl b/test/http_SUITE_data/http_multipart_stream.erl index 82662ad..b739740 100644 --- a/test/http_SUITE_data/http_multipart_stream.erl +++ b/test/http_SUITE_data/http_multipart_stream.erl @@ -9,7 +9,7 @@ init(Req, Opts) -> {ok, cowboy_req:reply(200, Req2), Opts}. multipart(Req) -> - case cowboy_req:part(Req) of + case cowboy_req:read_part(Req) of {ok, [{<<"content-length">>, BinLength}], Req2} -> Length = list_to_integer(binary_to_list(BinLength)), {Length, Req3} = stream_body(Req2, 0), @@ -19,7 +19,7 @@ multipart(Req) -> end. stream_body(Req, N) -> - case cowboy_req:part_body(Req) of + case cowboy_req:read_part_body(Req) of {ok, Data, Req2} -> {N + byte_size(Data), Req2}; {more, Data, Req2} -> |