package vif

  1. Overview
  2. Docs

Module Vif.TypeSource

Type of requests.

Vif is able to dispatch requests not only by the route but also by the type of content of the request (given by the "Content-Type"). These values represent a certain type such as the type "application/json" or "multipart/form-data". These last two can be completed by an "encoding" making it possible to transform the content of the requests into an OCaml value.

Sourcetype null

Type of empty body requests.

Sourcetype json

Type of JSON requests (application/json).

Sourcetype multipart_form

Type of multipart/form-data requests.

Sourcetype ('c, 'a) t

Type to describe the body of requests.

Sourceval null : (null, unit) t
Sourceval json_encoding : 'a Jsont.t -> (json, 'a) t

json_encoding t is an application/json request whose content is a JSON value that complies with the given format t.

m t is a multipart/form-data request whose content is a value that complies with the given format t.

multipart_form is a multipart/form-data request whose content can be consumed as a stream (see section:multipart-stream)

Sourceval any : ('c, string) t

any allows requests to be accepted without filtering by Content-Type. The content is interpreted as a string.