mist/http
Types
pub type DecodeError {
InvalidMethod
InvalidPath
UnknownHeader
}
Constructors
-
InvalidMethod
-
InvalidPath
-
UnknownHeader
pub type DecodedPacket {
BinaryData(HttpPacket, BitString)
EndOfHeaders(BitString)
MoreData(Option(Int))
}
Constructors
-
BinaryData(HttpPacket, BitString)
-
EndOfHeaders(BitString)
-
MoreData(Option(Int))
pub type HandlerError {
InvalidRequest(DecodeError)
NotFound
}
Constructors
-
InvalidRequest(DecodeError)
-
NotFound
pub type HttpPacket {
HttpRequest(Atom, HttpUri, #(Int, Int))
HttpHeader(Int, Atom, BitString, BitString)
}
Constructors
-
HttpRequest(Atom, HttpUri, #(Int, Int))
-
HttpHeader(Int, Atom, BitString, BitString)
pub type PacketType {
Http
HttphBin
HttpBin
}
Constructors
-
Http
-
HttphBin
-
HttpBin
Functions
pub fn encode_headers(headers: Map(String, String)) -> BitBuilder
pub fn from_header(value: BitString) -> String
pub fn handler(func: fn(Request(BitString)) ->
Response(BitString)) -> fn(HandlerMessage, #(Socket, Nil)) ->
Next(#(Socket, Nil))
This method helps turn an HTTP handler into a TCP handler that you can
pass to mist.serve
or glisten.serve
pub fn parse_headers(bs: BitString, headers: List(
#(String, String),
)) -> Result(#(List(#(String, String)), BitString), DecodeError)
pub fn parse_request(bs: BitString) -> Result(
Request(BitString),
DecodeError,
)
Turns the TCP message into an HTTP request
pub fn status_to_bit_string(status: Int) -> BitString
pub fn to_bit_builder(resp: Response(BitString)) -> BitBuilder
Turns an HTTP response into a TCP message