Skip to content

#363 breaks pyo3-pack (Regression in 0.9.3) #374

@konstin

Description

@konstin

In 0.9.2, the following works, while it fails in 0.9.3:

git clone https://github.com/PyO3/pyo3-pack
cargo run -- publish -u konstin -b bin -r https://test.pypi.org/legacy/ -m hello-world/Cargo.toml -p notmypassword

More specifically, I get the following error even though I'm using multipart POST:

<h1>405 Method Not Allowed</h1>
The method POST is not allowed for this resource. <br/><br/>

I've bisected and found the 44c8ca3 introduced by #363 causes pyo3-pack to break.

I'm using the following code for the request (complete source):

let mut form = Form::new();
for (key, value) in joined_metadata {
    form = form.text(key, value.to_owned())
}
form = form.file("content", &wheel_path)?;
let client = Client::new();
let mut response = client
    .post(registry.url.clone())
    .header(reqwest::header::CONTENT_TYPE, "application/json; charset=utf-8")
    .multipart(form)
    .basic_auth(registry.username.clone(), Some(registry.password.clone()))
    .send()?;

I know it's a difficult if people have conflicting requirements, but there should be at least a switch to get back the old behaviour. FWIW the old behaviour is also apparently what python's requests does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug. Something is wrong. This is bad!

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions