mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Add test for the compress_response example
This commit is contained in:
parent
61d66a4de2
commit
1504c60c89
1 changed files with 19 additions and 0 deletions
|
@ -149,6 +149,25 @@ do_chunked_hello_world(Transport, Protocol, Config) ->
|
||||||
ok
|
ok
|
||||||
end.
|
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.
|
||||||
|
|
||||||
cookie(Config) ->
|
cookie(Config) ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue