webmachine

A REST toolkit for OCaml
IN THIS PACKAGE
Module type Webmachine . S
constraint 'body = [> `Empty ]
method virtual content_types_provided : ( (string * 'body provider) list, 'body ) op
method virtual content_types_accepted : ( (string * 'body acceptor) list, 'body ) op
method resource_exists : ( bool, 'body ) op

Returning false will result in a 404 Not Found.

Default: true

method service_available : ( bool, 'body ) op

Returning false will result in a 503 Service Unavilable.

Default: true

method is_authorized : ( auth, 'body ) op
method forbidden : ( bool, 'body ) op

Returning true will result in a 403 Forbidden.

Default: false

method malformed_request : ( bool, 'body ) op

Returning true will result in a 400 Bad Request.

Default: false

method uri_too_long : ( bool, 'body ) op

Returning true will result in a 414 Request-URI Too Long.

Default: false

method known_content_type : ( bool, 'body ) op

Returning false will result in a 415 Unsupported Media Type.

Default: true

method valid_content_headers : ( bool, 'body ) op

Returning false will result in a 501 Not Implemented.

Default: true

method valid_entity_length : ( bool, 'body ) op

Returning false will result in 413 Request Entity Too Large.

Default : true

method options : ( (string * string) list, 'body ) op

If the `OPTIONS method is supported by this resource, the returned list of header name/value pairs will be included in responses to `OPTIONS requests.

Default: [("allow", self#allowed_methods)]

method known_methods : ( Cohttp.Code.meth list, 'body ) op

A request to this resource whose method is not included in the returned list will result in a 501 Not Implemented.

Default: [`GET; `HEAD; `POST; `PUT; `DELETE; `Other "TRACE"; `Other "CONNECT"; `OPTIONS]

method allowed_methods : ( Cohttp.Code.meth list, 'body ) op

A request to this resource whose method is not included in the returned list will result in a 405 Method Not Allowed. The response will include an "allow" header that lists the allowed methods.

Default: [`GET; `HEAD]

method delete_resource : ( bool, 'body ) op

`DELETE requests will call this method. Returning true indicates that the deletion succeeded.

Default: false

method delete_completed : ( bool, 'body ) op

Only successful delete_resource calls will result in a call to this method. Return false if the deletion was accepted but cannot yet be guaranteed to have finished.

Default: true

method process_post : ( bool, 'body ) op

`POST requests will call this method. Returning true indicates the POST succeeded.

method language_available : ( bool, 'body ) op

Returning false will result in a 406 Not Acceptable.

Default: true

method charsets_provided : ( (string * ( 'body -> 'body )) list, 'body ) op
method encodings_provided : ( (string * ( 'body -> 'body )) list, 'body ) op
method variances : ( string list, 'body ) op

Returns a list of header names that should be included in the response's Vary header. The standard content negotiation headers (i.e., Accept, Accept-Encoding, Accept-Charset, Accept-Language) will automatically be added if needed, and therefore do not need to be specified here.

Default: []

method is_conflict : ( bool, 'body ) op

Returning true will result in a 409 Conflict.

Default: false

method multiple_choices : ( bool, 'body ) op

Returning true indicates that multiple representations of the resource exist and a single one cannot be automatically chosen, resulting in a 300 Multiple Choices rather than a 200 OK.

Default: false

method previously_existed : ( bool, 'body ) op
method moved_permanently : ( Uri.t option, 'body ) op
method moved_temporarily : ( Uri.t option, 'body ) op
method last_modified : ( string option, 'body ) op
method expires : ( string option, 'body ) op
method generate_etag : ( string option, 'body ) op

Returning Some string will use string for the ETag header.

Default: None

method finish_request : ( unit, 'body ) op

This method is called just before the final response is constructed and returned.