aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-02-05 17:32:03 +0100
committerLoïc Hoguin <[email protected]>2017-02-05 17:32:03 +0100
commit1504c60c899114ce25f5b17d78168f03258df20f (patch)
tree91464db17149f839d3512211664094f3080cf790 /test
parent61d66a4de2f1e16cd08953dee9c780098a0551e9 (diff)
downloadcowboy-1504c60c899114ce25f5b17d78168f03258df20f.tar.gz
cowboy-1504c60c899114ce25f5b17d78168f03258df20f.tar.bz2
cowboy-1504c60c899114ce25f5b17d78168f03258df20f.zip
Add test for the compress_response example
Diffstat (limited to 'test')
-rw-r--r--test/examples_SUITE.erl19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/examples_SUITE.erl b/test/examples_SUITE.erl
index 6ef5471..ff0457a 100644
--- a/test/examples_SUITE.erl
+++ b/test/examples_SUITE.erl
@@ -149,6 +149,25 @@ do_chunked_hello_world(Transport, Protocol, Config) ->
ok
end.
+%% Compressed responses.
+
+compress_response(Config) ->
+ doc("Compressed response example."),
+ try
+ do_compile_and_start(compress_response),
+ do_compress_response(tcp, http, Config),
+ do_compress_response(tcp, http2, Config)
+ after
+ do_stop(compress_response)
+ end.
+
+do_compress_response(Transport, Protocol, Config) ->
+ {200, Headers, Body} = do_get(Transport, Protocol, "/",
+ [{<<"accept-encoding">>, <<"gzip">>}], Config),
+ {_, <<"gzip">>} = lists:keyfind(<<"content-encoding">>, 1, Headers),
+ _ = zlib:gunzip(Body),
+ ok.
+
%% Cookie.
cookie(Config) ->