treeform / puppy

Puppy fetches via HTTP and HTTPS
MIT License
185 stars 27 forks source link

multipart/form-data #9

Closed juancarlospaco closed 1 year ago

juancarlospaco commented 3 years ago

How to POST multipart/form-data ?, is it supported ?.

guzba commented 3 years ago

In the end that body format ends up as a string like json or form-urlencoded data post bodies do so you could produce the correct post body string and set the correct header and it should work without any trouble. There just isn't APIs in puppy to make multipart/form-data easier.

treeform commented 3 years ago

I looked into this a bit, it looks like libcurl has a multipart API https://curl.se/libcurl/c/postit2.html . But the windows part does not: https://stackoverflow.com/questions/3885703/post-method-winhttprequest-multipart-form-data . If we are going to build a multi part string for windows, we might as well use that for libcurl too.

guzba commented 1 year ago

Update on this issue. We've added some helpers for building a multipart request body and have added an example showing how to do multipart/form-data here: https://github.com/treeform/puppy/pull/98/files

This is tagged in Puppy 2.0.3