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
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.

Cargo.toml Outdated Show resolved Hide resolved
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.

None yet

2 participants