package caldav
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=47e8daa3246d42bab21696d7a81a8b2e5cf68551f64be440778d4ea70c4ec04a
sha512=881692617a96640dbaeff056bccd3ef57aa06baaae2cd2faaaf7adf76b0c0bcd0a573ab348185064e1a40cf8bc44660c4f0891d9e259b48ccb55847774890854
doc/caldav.webmachine/Webmachine/module-type-S/index.html
Module type Webmachine.SSource
type auth = [ | `Authorized| `Basic of string| `Challenge of www_authenticate| `Redirect of Uri.t
]type collection_created_response = [ | `Created| `Forbidden| `Method_not_allowed| `Conflict| `Unsupported_media_type| `Insufficient_storage
]respond ?body n rd is equivalent to IO.return (Error n, { rd with resp_body = body }
val to_handler :
?dispatch_path:string ->
?path_info:(string * string) list ->
resource:'body resource ->
body:'body ->
request:Cohttp.Request.t ->
unit ->
(Cohttp.Code.status_code * Cohttp.Header.t * 'body * string list) ioto_handler ~resource ~body ~request () runs the resource through the HTTP decision diagram given body and request. The result is a tuple that contains the status code, headers and body of the response. The final element of the tuple is a list of decision diagram node names that is useful for debugging.
val dispatch :
((Dispatch.tag * string) list * Dispatch.typ * (unit -> 'body resource)) list ->
body:'body ->
request:Cohttp.Request.t ->
(Cohttp.Code.status_code * Cohttp.Header.t * 'body * string list) option iodispatch routes returns a request handler that will iterate through routes and dispatch the request to the first resources that matches the URI path. The form that the individal route entries takes this the following:
(pattern, exact, resource_constructor)The pattern itself is a list of literal (`Lit) or variable matches (`Var) that the URI path should satify. For example, a route entry that will be associated with a particular user in the system would look like this:
([`Lit, "user"; `Var, "id"], `Exact, user_resource)This would match a URI path such as "/user/10" but would not match a URI such as "/usr/10/preferences", since the exact component of the route tuple is `Exact.
val dispatch' :
(string * (unit -> 'body resource)) list ->
body:'body ->
request:Cohttp.Request.t ->
(Cohttp.Code.status_code * Cohttp.Header.t * 'body * string list) option iodispatch' routes ~body ~request works in the same way as dispatch except the user can specify path patterns using a string shorthand. For example, the following route entry:
("/user/:id/*", user_resource)translates to:
([`Lit, "user"; `Var "id"], `Prefix, user_resource)