interface wasi-http { /// The HTTP status code. type http-status = u16; /// The HTTP body. type body = list; /// The HTTP headers represented as a list of (name, value) pairs. type headers = list>; /// The HTTP parameter queries, represented as a list of (name, value) pairs. type params = list>; /// The HTTP URI of the current request. type uri = string; /// The HTTP method. enum method { get, post, put, delete, patch, head, options, } /// An HTTP request. record request { method: method, uri: uri, headers: headers, params: params, body: option, } /// An HTTP response. record response { status: http-status, headers: option, body: option, } /// HTTP errors returned by the runtime. variant http-error { invalid-url(string), timeout-error(string), protocol-error(string), status-error(u16), unexpected-error(string) } handle-http: func(req: request) -> result; } default world serverless { export handler: self.wasi-http; }