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:
parent
413196ace1
commit
3c198f7d90
3 changed files with 141 additions and 8 deletions
|
@ -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) ->
|
||||
|
|
|
@ -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}.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue