This version of the module is deprecated: Renamed to gaato/mttp 0.3, the module an app adds; the I/O-free core is gaato/mttp_core. See https://github.com/gaato/mttp
///|
async test "listener errors are distinct from connection errors" {
try @server.serve(_ => @mttp.Response::new(204), addr="invalid") catch {
@server.Bind(..) => ()
error => raise error
} noraise {
_ => fail("invalid address accepted")
}
}pub(all) suberror ListenError {
Config(ServerConfigError)
Bind(detail~ : String)
Accept(detail~ : String)
} derive(Debug)impl Show for ListenErrorasync fn serve(handler : async (Request) -> Response noraise, addr~ : String, limits? : ServerLimits, on_listen? : (String) -> Unit, on_error? : (TransportError) -> Unit) -> Unit raise ListenErrorInstall
Download zipHTTP for MoonBit apps that outgrow the built-in client: the module an app starts with, holding a ready client (retries with a budget, deadlines, redirects, cookies, decompression) and a server, on moonbitlang/core/async for native, wasm and js. Typed endpoints and OpenAPI come from gaato/mttp, which libraries depend on instead.