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

Add public interface to Multipart's Part headers #1687

Merged
merged 6 commits into from
Jan 3, 2023

Conversation

beeb
Copy link
Contributor

@beeb beeb commented Nov 21, 2022

I have an application where I'd like to add compressed files to a multipart form request, and would like to set the content-encoding header for said files in the request. However, the current implementation doesn't allow editing the metadata on multipart::Parts. I added the necessary public setters to be able to to add custom headers to the multipart items.

@beeb
Copy link
Contributor Author

beeb commented Nov 29, 2022

@seanmonstar is this project open to PRs?

@seanmonstar
Copy link
Owner

Yes it is, sorry, got lost in a short week.

@beeb
Copy link
Contributor Author

beeb commented Nov 29, 2022

Oh no worries! Let me know if anything needs to be changed in this proposal

EDIT : looks like a missed a use, let me fix that

@beeb
Copy link
Contributor Author

beeb commented Dec 1, 2022

The CI failures seem unrelated to the code itself

@beeb
Copy link
Contributor Author

beeb commented Jan 3, 2023

@seanmonstar hope you had a good holiday season and started the new year well! I have merged master into my branch so hopefully everything should be green on the CI side now. Best

use mime_guess::Mime;
use percent_encoding::{self, AsciiSet, NON_ALPHANUMERIC};

use futures_core::Stream;
use futures_util::{future, stream, StreamExt};

use super::Body;
use crate::header::HeaderMap;
Copy link
Contributor Author

@beeb beeb Jan 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this made sense since the request.rs also uses the re-exported HeaderMap

@seanmonstar seanmonstar merged commit b16ea79 into seanmonstar:master Jan 3, 2023
Nutomic pushed a commit to Nutomic/reqwest that referenced this pull request Nov 7, 2024
* feat(async_impl): set custom headers on multipart Part

* feat(blocking): set custom headers on multipart

* test(multipart): use new method to add custom headers

* fix: missing import

* refactor(multipart): use concrete type for headers setter arg
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