-
Notifications
You must be signed in to change notification settings - Fork 172
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
Any example of multipart post? #120
Comments
@elasmojs there isn't any built in support for multipart forms. Constructing the multipart is easy enough though – I was briefly looking through crates.io, but can't find a framework agnostic impl. Could be I didn't look hard enough, or that that someone really ought to build a generic multipart builder. I think the API should look something like this: let multi = MultipartBuilder::new()
.addText("Some text") // Content-Disposition: form-data; name="text"
.addFile("myfile.txt") // Content-Disposition: form-data; name="file1"; filename="myfile.txt"
.build().unwrap(); // delay io errors to here
let res = ureq::post("https://my-fine.server")
.set("content-length", multi.len())
.set("content-type", multi.content_type()) // multipart/form-data; boundary=----90519140972754266
.send(multi.into_reader()); |
@algesten , thank you for the response. I have solved this by using https://crates.io/crates/multipart |
@elasmojs can you provide an example, please? |
I came across this too, and also implemented it myself. To aid any future visitors, I have written up a gist which should serve as a good template: |
i implemented a multipart toolkit for ureq: usage: ` let (content_type,data) = MultipartBuilder::new() |
i have public ureq_multipart 1.1 ,add ureq request send multipart method:
|
FYI, the I'd love to see See also PyO3/maturin#1858 |
Hi, Thanks to ureq, have achieved what I wanted to a large extent in my project. Is there any multipart suppor/example right now?
The text was updated successfully, but these errors were encountered: