0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 04:30:25 +00:00

Fix and update the compress example to use cowboy_compress_h

This commit is contained in:
Loïc Hoguin 2017-01-22 20:17:52 +01:00
parent 413196ace1
commit 3c198f7d90
No known key found for this signature in database
GPG key ID: 71366FF21851DF03
3 changed files with 141 additions and 8 deletions

View file

@ -16,10 +16,10 @@ start(_Type, _Args) ->
{"/", toppage_handler, []}
]}
]),
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
{compress, true},
{env, [{dispatch, Dispatch}]}
]),
{ok, _} = cowboy:start_clear(http, 100, [{port, 8080}], #{
env => #{dispatch => Dispatch},
stream_handlers => [cowboy_compress_h, cowboy_stream_h]
}),
compress_response_sup:start_link().
stop(_State) ->

View file

@ -19,5 +19,5 @@ have established the ability to work at virtually identical tasks and obtained
considerable respect for their achievements. There are also cattle handlers
in many other parts of the world, particularly South America and Australia,
who perform work similar to the cowboy in their respective nations.\n">>,
Req = cowboy_req:reply(200, [], BigBody, Req0),
Req = cowboy_req:reply(200, #{}, BigBody, Req0),
{ok, Req, Opts}.