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
-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.
-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.