View Source cowmachine_response (cowmachine v1.13.1)

Response functions, generate the response inclusive body and headers. The body can be sourced from multiple sources. These sources include files, binary files and functions. The response body function handles range requests.

Summary

Functions

Send responce.

Returns server header.

Functions

send_response(Context)

-spec send_response(Context) -> Result
                       when
                           Context :: cowmachine_req:context(),
                           Result :: {ok, Req, Env} | {stop, Req},
                           Req :: cowboy_req:req(),
                           Env :: cowboy_middleware:env().

Send responce.

send_stream_body(FunContext, Context)

-spec send_stream_body(FunContext, Context) -> Result
                          when
                              FunContext :: {InitialData, InitialFun} | InitialFun,
                              InitialData ::
                                  binary() |
                                  {file, Filename} |
                                  {file, Size, Filename} |
                                  done | WriterFun,
                              Filename :: file:filename_all(),
                              WriterFun :: function(),
                              Size :: non_neg_integer(),
                              InitialFun :: function(),
                              Context :: cowmachine_req:context(),
                              Result :: cowmachine_req:context().

Send stream body.

server_header()

-spec server_header() -> Result when Result :: binary().

Returns server header.