Skip to content

400 Bad Request after upgrading to 0.12.1 #2202

@NTmatter

Description

@NTmatter

Some requests have started failing after upgrading from 0.11.27 to 0.12.1.

In this case, api.figma.com works in 0.11.27 and fails in 0.12.1. A test of www.figma.com shows that both versions of reqwest are fine.

Results on 0.11.27:

Success!

Results on 0.12.1:

Failed to retrieve data: 400 Bad Request
[src/main.rs:12:9] res = "<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n</body>\r\n</html>\r\n"

main.toml:

[package]
name = "fetch-fail"
version = "0.1.0"
edition = "2021"
publish = false

[dependencies]
anyhow = "1.0.81"
reqwest = "0.11.27"
#reqwest = "0.12.1"
tokio = { version = "1.36.0", features = ["full"] }

main.rs:

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // let res = reqwest::get("https://www.figma.com/").await?;
    // let res = reqwest::get("https://api.figma.com/v1/activity_logs").await?;
    let res = reqwest::get("https://api.figma.com/").await?;
    let status = res.status();
    let res = res.text().await?;

    if status == 200 {
        println!("Success!");
    } else {
        eprintln!("Failed to retrieve data: {status}");
        dbg!(res);
    }

    Ok(())
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions