From 768772150987495450b63610ad99bf73c1ecbf57 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Wed, 18 Dec 2024 10:08:32 -0700 Subject: [PATCH] add `response-outparam.send-informational` This allows a server to send zero or more HTTP 1xx responses prior to sending the final response using `response-outparam.set`. Note that this does not include support for consuming informational responses for outbound requests (which would be required to losslessly proxy such requests). Signed-off-by: Joel Dice --- wit/types.wit | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wit/types.wit b/wit/types.wit index 2498f18..aea0077 100644 --- a/wit/types.wit +++ b/wit/types.wit @@ -435,6 +435,21 @@ interface types { /// other argument to `incoming-handler.handle`. @since(version = 0.2.0) resource response-outparam { + /// Send an HTTP 1xx response. + /// + /// Unlike `response-outparam.set`, this does not consume the + /// `response-outparam`, allowing the guest to send an arbitrary number of + /// informational responses before sending the final response using + /// `response-outparam.set`. + /// + /// This will return an `HTTP-protocol-error` if `status` is not in the + /// range [100-199], or an `internal-error` if the implementation does not + /// support informational responses. + @unstable(feature = informational-outbound-responses) + send-informational: func( + status: u16, + headers: headers + ) -> result<_, error-code>; /// Set the value of the `response-outparam` to either send a response, /// or indicate an error.