cli icon indicating copy to clipboard operation
cli copied to clipboard

support multipart/related upload ?

Open c0b opened this issue 9 years ago • 1 comments

I'm using this tool to debug / simulate some interaction with Google Drive API, not sure how can httpie simulate a multipart/related POST? or if I am right, this will be a new feature request, how about a user interface like this; the boundary string can be automatically generated, that doesn't matter (or allow user to specify by --boundary ???)

$ http POST https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart \
  "Authorization: Bearer $access_token" \
  --part "application/json" name="My File" attr2=value2 attr3=value3 \
  --part "image/jpeg" @./path/to/a/picture.jpeg

https://developers.google.com/drive/v3/web/manage-uploads#multipart

POST /upload/drive/v3/files?uploadType=multipart HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer your_auth_token
Content-Type: multipart/related; boundary=foo_bar_baz
Content-Length: number_of_bytes_in_entire_request_body

--foo_bar_baz
Content-Type: application/json; charset=UTF-8

{
  "name": "My File"
}

--foo_bar_baz
Content-Type: image/jpeg

JPEG data
--foo_bar_baz--

c0b avatar Dec 02 '16 04:12 c0b

What about optional Content-ID for parts? Like --part "my-id:application/json"

martin-sladecek avatar Jun 22 '18 20:06 martin-sladecek