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

Alias for setBodyAsString.

setBodyAsBytes : Bytes -> Response -> Response

Set the body of the response to some bytes.

setBodyAsString : String -> Response -> Response

Set the body of the response to a string.

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.