-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
method HEAD error #218
Comments
Could you try with this in your [dependencies]
surf = { version = "2.0.0-alpha.4", features = ["h1-client"] } |
Yes, I've tried surf = { version = "2.0.0-alpha.4", features = [ "h1-client" , "middleware-logger", "encoding"], default-features = false } but with no luck |
getting the same error with
|
For what it's worth, this is a programmer error: client.head("http://a.b").recv_string().await?; It is a bug that this panics but will definitely continue to fail. client.head("http://a.b").await?; |
The docs should be updated when this is fixed as well, as we chatted about in discord, since the docs still show this as the usage: Line 346 in 55c5d6a
|
Upon further investigation it seems like this is only an issue with the default curl-based client. Try this: surf = { version = "2.1", default-features = false, features = ["h1-client", "encoding"] } Note that the async-h1 client is presently still missing a lot of client functionality, listed here:
You could also use |
That being said, I can't reproduce the panic. For me this test just hangs forever. This machine is running Ubuntu 20 if that matters. Can anyone get a bracktrace? |
Ironically, CI running Ubuntu 20 does fail.
|
So... what is the correct way to do a basic HEAD request with #[async_std::main]
async fn main() -> surf::Result<()> {
let client = surf::client();
let req = client.head("https://example.com");
let resp = req.await;
dbg!(&resp);
let resp = surf::head("https://example.com").await;
dbg!(&resp);
let resp = surf::head("https://example.com").send().await;
dbg!(&resp);
Ok(())
} What does work:
The error type |
Use the |
If there is no body then don't construct a zero-lengthed body. Fixes: http-rs/surf#321 Fixes: http-rs/surf#218
If there is no body then don't construct a zero-lengthed body. Fixes: http-rs/surf#321 Fixes: http-rs/surf#218
If there is no body then don't construct a zero-lengthed body. Fixes: http-rs/surf#321 Fixes: http-rs/surf#218
I tried to use http HEAD method and it would hand
And if i replace http with https, it would give me exception
If I replace
head
withget
, all things goes well.The text was updated successfully, but these errors were encountered: