Resource.t
inherit Site.raw_resource
val can_get : Role.t
The role the client needs in order to make a GET request.
val can_post : Role.t
The role the client needs in order to make a POST request.
method private get : Context.t -> (Cohttp.Response.t * Cohttp_lwt.Body.t) Lwt.t
Concrete resources should override this method to handle GET requests. get_raw
checks that the caller has the can_get
role and then calls this. The default method returns a `Bad_request
error.
method private post : Context.t ->
string ->
(Cohttp.Response.t * Cohttp_lwt.Body.t) Lwt.t
Concrete resources should override this method to handle POSTs. get_post
checks that the caller has the can_post
role, reads the body, checks the CSRF token, and then calls this. The default method returns a `Bad_request
error.