multipart http requests support (file uploads)
DonsWayo opened this issue · 4 comments
DonsWayo commented
Is posible to create a multipart request with this library?
Thanks!
jossef commented
it's a good feature. not yet implemented.
would you like to fork this repo, add multipart support and submit a PR?
mingsai commented
Seems like this might be a good place to start (source):
var uri = Uri.parse('https://example.com/create');
var request = http.MultipartRequest('POST', uri)
..fields['user'] = 'nweiz@google.com'
..files.add(await http.MultipartFile.fromPath(
'package', 'build/package.tar.gz',
contentType: MediaType('application', 'x-tar')));
var response = await request.send();
if (response.statusCode == 200) print('Uploaded!');
jossef commented
📣 Need help on this one. Please submit a PR 🙏
mark8044 commented
+1 on this.
Requests has been a game changer. However I recently came across the need to upload images and find myself having to unwind this package from my app completely. This type of package is all-or-none so this is a must-need addition.
Holding out hope for this!