From ae0dd616737d8e1116de4a04be0bc84188997eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 10 Aug 2016 11:49:31 +0200 Subject: Add tests for responses and request body reading This is a large commit. The cowboy_req interface has largely changed, and will change a little more. It's possible that some examples or tests have not been converted to the new interface yet. The documentation has not yet been updated. All of this will be fixed in smaller subsequent commits. Gotta start somewhere... --- test/http_SUITE_data/http_body_qs.erl | 2 +- test/http_SUITE_data/http_loop_stream_recv.erl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test/http_SUITE_data') diff --git a/test/http_SUITE_data/http_body_qs.erl b/test/http_SUITE_data/http_body_qs.erl index e0673cf..09ca5e4 100644 --- a/test/http_SUITE_data/http_body_qs.erl +++ b/test/http_SUITE_data/http_body_qs.erl @@ -10,7 +10,7 @@ init(Req, Opts) -> {ok, maybe_echo(Method, HasBody, Req), Opts}. maybe_echo(<<"POST">>, true, Req) -> - case cowboy_req:body_qs(Req) of + case cowboy_req:read_urlencoded_body(Req) of {badlength, Req2} -> echo(badlength, Req2); {ok, PostVals, Req2} -> diff --git a/test/http_SUITE_data/http_loop_stream_recv.erl b/test/http_SUITE_data/http_loop_stream_recv.erl index c006b6d..18b3d29 100644 --- a/test/http_SUITE_data/http_loop_stream_recv.erl +++ b/test/http_SUITE_data/http_loop_stream_recv.erl @@ -15,7 +15,7 @@ info(stream, Req, undefined) -> stream(Req, 1, <<>>). stream(Req, ID, Acc) -> - case cowboy_req:body(Req) of + case cowboy_req:read_body(Req) of {ok, <<>>, Req2} -> {stop, cowboy_req:reply(200, Req2), undefined}; {_, Data, Req2} -> -- cgit v1.2.3