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

[Feature Request] Add option to customize boundary in multipart request #2374

Open
Tienisto opened this issue Aug 7, 2024 · 6 comments
Open

Comments

@Tienisto
Copy link

Tienisto commented Aug 7, 2024

Hello,

I would like to provide a custom boundary for the multipart request.
It seems that it is currently hard coded to generate a random string:

boundary: gen_boundary(),

I would like to provide a custom boundary like this:

let mut form = reqwest::multipart::Form::new();
form = form.boundary("-----------------custom boundary");
@ovnicraft
Copy link
Contributor

@Tienisto as you mention gen_boundary() generates a random value

fn gen_boundary() -> String {

looks easy to add it, can you gives more info about why do yo need it?

@Tienisto
Copy link
Author

I am developing an API client. I can imagine that users might want to provide a custom boundary to debug or test things out.
I think this is quite niche though.

@ovnicraft
Copy link
Contributor

I'll open a PR and let's see if it works for you.

@seanmonstar
Copy link
Owner

Is there an actual use case needed, or is it currently only that some users might want it?

I don't feel particularly inclined to add it for a hypothetical...

@Tienisto
Copy link
Author

Well, as I mentioned, I am developing an API client (similar to Postman or Insomnia) so I would like to have this feature (that's why I created this issue). If there is a hypothetical security vulnerability when setting a specific boundary, then users might want to try it out without digging into hyper or switching to Python.

Besides that, what is the purpose of exposing the boundary in the first place if we assume that it is a low-level concern? Adding a setter next to the getter would seem logical.

@ovnicraft
Copy link
Contributor

also would like to know what the http spec said about it?

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

No branches or pull requests

3 participants