Skip to content

Commit aa2a8cf

Browse files
committed
Relax wasi 0.2 constraint
Signed-off-by: Darwin Boersma <[email protected]>
1 parent 6c0c68f commit aa2a8cf

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

crates/http/src/trigger.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ pub enum HandlerType {
2727
pub const WASI_HTTP_EXPORT_2023_10_18: &str = "wasi:http/[email protected]";
2828
/// The `incoming-handler` export for `wasi:http` version rc-2023-11-10
2929
pub const WASI_HTTP_EXPORT_2023_11_10: &str = "wasi:http/[email protected]";
30-
/// The `incoming-handler` export for `wasi:http` version 0.2.0
31-
pub const WASI_HTTP_EXPORT_0_2_0: &str = "wasi:http/[email protected]";
32-
/// The `incoming-handler` export for `wasi:http` version 0.2.1
33-
pub const WASI_HTTP_EXPORT_0_2_1: &str = "wasi:http/[email protected]";
30+
/// The `incoming-handler` export prefix for all `wasi:http` 0.2 versions
31+
pub const WASI_HTTP_EXPORT_0_2_PREFIX: &str = "wasi:http/[email protected]";
3432
/// The `inbound-http` export for `fermyon:spin`
3533
pub const SPIN_HTTP_EXPORT: &str = "fermyon:spin/inbound-http";
3634

@@ -58,8 +56,8 @@ impl HandlerType {
5856
match name {
5957
WASI_HTTP_EXPORT_2023_10_18 => set(HandlerType::Wasi2023_10_18)?,
6058
WASI_HTTP_EXPORT_2023_11_10 => set(HandlerType::Wasi2023_11_10)?,
61-
WASI_HTTP_EXPORT_0_2_0 | WASI_HTTP_EXPORT_0_2_1 => set(HandlerType::Wasi0_2)?,
6259
SPIN_HTTP_EXPORT => set(HandlerType::Spin)?,
60+
name if name.starts_with(WASI_HTTP_EXPORT_0_2_PREFIX) => set(HandlerType::Wasi0_2)?,
6361
_ => {}
6462
}
6563
}
@@ -69,8 +67,7 @@ impl HandlerType {
6967
"Expected component to export one of \
7068
`{WASI_HTTP_EXPORT_2023_10_18}`, \
7169
`{WASI_HTTP_EXPORT_2023_11_10}`, \
72-
`{WASI_HTTP_EXPORT_0_2_0}`, \
73-
`{WASI_HTTP_EXPORT_0_2_1}`, \
70+
`{WASI_HTTP_EXPORT_0_2_PREFIX}.*`, \
7471
or `{SPIN_HTTP_EXPORT}` but it exported none of those"
7572
)
7673
})

0 commit comments

Comments
 (0)