View Source cowmachine_response (cowmachine v1.12.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.

Link to this section Summary

Functions

Send responce.
Returns server header.

Link to this section Functions

-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.
Link to this function

send_stream_body(FunContext, Context)

View Source
-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.
-spec server_header() -> Result when Result :: binary().
Returns server header.