HttpServer.Response
Build up a response as a command.
Usually this will look something like this,
in your update
function,
assuming you subscribed with a GotRequest
msg:
GotRequest req res ->
{ model = model
, command =
res
|> Response.setHeader "Content-type" "text/html"
|> Response.setBody ("<html>Hello there!</html>")
|> Response.send
}
type Response
An HTTP response.
send :
Response -> Cmd a
Command to send an HTTP response.
setBody :
String -> Response -> Response
Set the body on a response.
setHeader :
String -> String -> Response -> Response
Add a header key/value pair to a response.
setStatus :
Int -> Response -> Response
Set the HTTP status code on a response.