View Source cowmachine_controller (cowmachine v1.12.1)

Link to this section Summary

Functions

Export and run function Fun.
Export and process State with Context.

Link to this section Types

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

Link to this section Functions

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

do_process(ContentType, State, Context)

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