Skip to content
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

Body from tokio::fs::File #1360

Merged
merged 3 commits into from
Oct 21, 2021
Merged

Conversation

fredr
Copy link
Contributor

@fredr fredr commented Oct 18, 2021

Was it something like this you had in mind @seanmonstar ? In the comment you wrote here: #1357 (review)

Example usage

use tokio::fs::File;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let file = File::open("/path/to/file").await?;
    let client = reqwest::Client::new();
    let res = client
        .post("http://localhost:8080/upload")
        .body(file)
        .send()
        .await?;

    println!("{:?}", res);

    Ok(())
}

@fredr fredr force-pushed the stream-body-from-file branch from d692c4e to 92d4453 Compare October 18, 2021 18:53
@fredr
Copy link
Contributor Author

fredr commented Oct 18, 2021

Or should this be under the stream-feature?

I moved it behind the stream feature flag, that seemed to be a better place for it. Let me know if that was wrong.

@fredr fredr force-pushed the stream-body-from-file branch from 92d4453 to 983cbff Compare October 18, 2021 19:25
@fredr fredr force-pushed the stream-body-from-file branch from faf6d34 to a653094 Compare October 19, 2021 08:12
Cargo.toml Outdated Show resolved Hide resolved
@seanmonstar seanmonstar merged commit ab49de8 into seanmonstar:master Oct 21, 2021
@fredr fredr deleted the stream-body-from-file branch October 22, 2021 07:36
Nutomic pushed a commit to Nutomic/reqwest that referenced this pull request Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants