Closed stone-bits closed 3 years ago
Odd. That seems like a bug, not sure from where or why though.
@igor-tk Are you initializing the tokio runtime anywhere? You may need to do that, Surf probably won't do that for you but isahc may internally.
I set #[tokio::main]
There is no other code. It's isolated short example. Without curl-client
it does not work. With curl-client
option it works using hyper and tokio.
This is very strange, since isahc does not use tokio directly at all: https://github.com/sagebind/isahc/blob/master/Cargo.toml
I honestly have no idea.
The ci improvements I merged yesterday include hyper in the ci matrix and it seems to work: https://github.com/http-rs/surf/pull/263
I think this should be fixed if you do cargo update
, see https://github.com/http-rs/http-client/commit/ec039a45f4c793b5e2ee7c996a3dcdeeee2b78cd
Still getting this error with:
surf = { version = "2.3.2", default-features = false, features = [
"hyper-client",
"middleware-logger",
"encoding",
] }
thread 'main' panicked at 'there is no timer running, must be called from the context of a Tokio 0.2.x runtime', /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-0.2.25/src/time/driver/handle.rs:24:32
I specify
hyper-client
as http backend.But, unfortunately, that does not work:
thread 'main' panicked at 'not currently running on the Tokio runtime.'
When I add
curl-client
to features:surf = { version = "2.1", default-features = false, features = ["hyper-client", "encoding", "curl-client"] }
It works.
But it seems like I have many unnecessary dependencies now (curl, isahc, etc.) that enabled by
curl-client
feature.Can
hyper-client
work withoutcurl-client
?