cleanup multipart
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
Dec 28, 2015 at 07:54 UTC
9c641f9906fcfd99175f7e3a03afc55f805d1702
2 files changed
+1
-7
commands/http/client.go
-1
@@ -96,7 +96,6 @@ func (c *client) Send(req cmds.Request) (cmds.Response, error) {
96
// TODO extract string consts?
97
if fileReader != nil {
98
httpReq.Header.Set(contentTypeHeader, "multipart/form-data; boundary="+fileReader.Boundary())
99
- httpReq.Header.Set(contentDispHeader, "form-data: name=\"files\"")
99
} else {
100
httpReq.Header.Set(contentTypeHeader, applicationOctetStream)
101
}
commands/http/multifilereader.go
+1
-6
@@ -92,12 +92,7 @@ func (mfr *MultiFileReader) Read(buf []byte) (written int, err error) {
92
// write the boundary and headers
93
header := make(textproto.MIMEHeader)
94
filename := url.QueryEscape(file.FileName())
95
- if mfr.form {
96
- contentDisposition := fmt.Sprintf("form-data; name=\"file\"; filename=\"%s\"", filename)
97
- header.Set("Content-Disposition", contentDisposition)
98
- } else {
99
- header.Set("Content-Disposition", fmt.Sprintf("file; filename=\"%s\"", filename))
100
- }
95
+ header.Set("Content-Disposition", fmt.Sprintf("file; filename=\"%s\"", filename))
96
97
header.Set("Content-Type", contentType)
98