-
Notifications
You must be signed in to change notification settings - Fork 290
Description
As of this writing, the spin-factor-outbound-http
, spin-http
, and spin-trigger-http
all use the wasmtime_wasi_http::p2::bindings::http::types::ErrorCode
type pervasively, either directly or via the wasmtime_wasi_http::body::Hyper{Outgoing, Incoming}Body
type aliases. Those types are used to model each combination of incoming and outgoing requests and responses. This kind of made sense given that WASIp2 was our focus, and we could adapt the deprecated spin:http
implementation to use the same types.
Now that we're adding WASIp3 support, though, using WASIp2 types everywhere makes less sense, so I took a stab at changing that. Specifically, I started switching from using BoxBody<Bytes, ErrorCode>
to hyper::body::Incoming
for incoming bodies and BoxBody<Bytes, Box<dyn std::error::Error>>
for outgoing ones. However, that broke certain assumptions about the same types being used for incoming and outgoing bodies, and it greatly expanded the scope of that PR.
Consequently, I'm doing the "easy" thing for that PR, which is to make the WASIp3 implementations use the p2 types, converting as necessary. That's not a great long term approach, though, hence this issue.
Open questions:
- What type(s) do we want to use to represent HTTP errors in Spin?
- Do we want to use the same error type for both incoming and outgoing bodies?