From 9c641f9906fcfd99175f7e3a03afc55f805d1702 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Mon, 28 Dec 2015 07:54:09 -0800 Subject: [PATCH] cleanup multipart License: MIT Signed-off-by: Jeromy --- commands/http/client.go | 1 - commands/http/multifilereader.go | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/commands/http/client.go b/commands/http/client.go index 44e32e02a..99a9f131f 100644 --- a/commands/http/client.go +++ b/commands/http/client.go @@ -96,7 +96,6 @@ func (c *client) Send(req cmds.Request) (cmds.Response, error) { // TODO extract string consts? if fileReader != nil { httpReq.Header.Set(contentTypeHeader, "multipart/form-data; boundary="+fileReader.Boundary()) - httpReq.Header.Set(contentDispHeader, "form-data: name=\"files\"") } else { httpReq.Header.Set(contentTypeHeader, applicationOctetStream) } diff --git a/commands/http/multifilereader.go b/commands/http/multifilereader.go index 4a564176a..1df121211 100644 --- a/commands/http/multifilereader.go +++ b/commands/http/multifilereader.go @@ -92,12 +92,7 @@ func (mfr *MultiFileReader) Read(buf []byte) (written int, err error) { // write the boundary and headers header := make(textproto.MIMEHeader) filename := url.QueryEscape(file.FileName()) - if mfr.form { - contentDisposition := fmt.Sprintf("form-data; name=\"file\"; filename=\"%s\"", filename) - header.Set("Content-Disposition", contentDisposition) - } else { - header.Set("Content-Disposition", fmt.Sprintf("file; filename=\"%s\"", filename)) - } + header.Set("Content-Disposition", fmt.Sprintf("file; filename=\"%s\"", filename)) header.Set("Content-Type", contentType)