View Source cowmachine_controller (cowmachine v1.13.1)

Summary

Functions

Export and run function Fun.

Export and process State with Context.

Types

cmstate/0

-type cmstate() ::
          #cmstate{controller :: atom(),
                   is_process_called :: boolean(),
                   cache :: map(),
                   options :: map()}.

Functions

do(Fun, State, Context)

-spec do(Fun, State, Context) -> Result
            when
                Fun :: atom(),
                State :: cmstate(),
                Context :: cowmachine_req:context(),
                Result :: {ContentType, Context},
                ContentType :: cow_http_hd:media_type().

Export and run function Fun.

do_process(ContentType, State, Context)

-spec do_process(ContentType, State, Context) -> Result
                    when
                        ContentType :: cow_http_hd:media_type(),
                        State :: cmstate(),
                        Context :: cowmachine_req:context(),
                        Result :: {Res, Context},
                        Res ::
                            boolean() |
                            cowmachine_req:halt() |
                            {error, any(), any()} |
                            {error, any()} |
                            cowmachine_req:resp_body().

Export and process State with Context.