Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Service
is the core abstraction that represents an HTTP server within http_async.
val sexp_of_request : request -> Sexplib0.Sexp.t
val sexp_of_response : response -> Sexplib0.Sexp.t
type t = request -> response Async.Deferred.t
t
is a function that takes a HTTP request and returns a deferred HTTP response.
val resource : request -> string
resource
returns the path and query for a given request.
val body : request -> string Async.Pipe.Reader.t
body
returns the HTTP request body for a given request.
val header : request -> string -> string option
header request key
returns the last header value associates with key
if one exists.
val header_multi : request -> string -> string list
header_multi request key
returns a list of all header values associated with key
.
val respond_string :
?headers:(string * string) list ->
?status:Status.t ->
string ->
response Async.Deferred.t
respond_string
creates a new fixed length encoded response from the user provided string. If the user provided headers don't contain a Content-Length header, one is added with the value set to the string's length.
val respond_bigstring :
?headers:(string * string) list ->
?status:Status.t ->
Core.Bigstring.t ->
response Async.Deferred.t
respond_bigstring
creates a new fixed length encoded response from the user provided Bigstring.t
. If the user provided headers don't contain a Content-Length header, one is added with the value set to the bigstring's length.
val respond_stream :
?headers:(string * string) list ->
?status:Status.t ->
string Async.Pipe.Reader.t ->
response Async.Deferred.t
respond_stream
creates a new streaming response. The data is chunk-encoded before its sent over the wire.