Unable to use custom methods for CORS
fwqaaq opened this issue · 1 comments
fwqaaq commented
Lines 56 to 59 in 3db61a4
Hey, guys, I wanted to use custom methods with http
crate. Like this:
type mismatch resolving `<Vec<Method> as IntoIterator>::Item == Method`
`http::Method` and `worker::Method` have similar names, but are actually distinct typesrustc[Click for full compiler diagnostic](rust-analyzer-diagnostics-view:/diagnostic%20message%20%5B12%5D?12#file%3A%2F%2F%2FUsers%2Ffeiwu%2FProject%2Frust%2Fcloudflare-webdav-rs%2Fsrc%2Flib.rs)
lib.rs(320, 10): required by a bound introduced by this call
method.rs(45, 1): `http::Method` is defined in crate `http`
http.rs(15, 1): `worker::Method` is defined in crate `worker`
lib.rs(315, 10): the method call chain might not have had the expected associated types
cors.rs(56, 41): required by a bound in `worker::Cors::with_methods`
Because your type is Item = Method
instead of http::Method
, this is very uncomfortable.
kflansburg commented
I suspect that this CORS
type will go away once we move to using http
crate. The idea is that utilities for constructing responses will come from the framework you are using (such as axum
). If you want to use this type, then I would not enable the http
feature.